Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional breakpoint fails to evaluate a string property #2683

Closed
dubeg opened this issue Nov 14, 2018 · 6 comments
Closed

Conditional breakpoint fails to evaluate a string property #2683

dubeg opened this issue Nov 14, 2018 · 6 comments

Comments

@dubeg
Copy link

dubeg commented Nov 14, 2018

Environment data

dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.403
Commit: 04e15494b6

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.403\

Host (useful for support):
Version: 2.1.5
Commit: 290303f510

.NET Core SDKs installed:
2.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

VS Code version: 1.29.0
C# Extension version: 1.17.0

Steps to reproduce

  • Add a conditional breakpoint evaluating a string property of an instance.
  • Start a debug session and hit the breakpoint.

Expected behavior

The conditional breakpoint works.

Actual behavior

There's an error in the debug console, and the breakpoint is hit regardless of the condition.

The condition for a breakpoint failed to execute. The condition was 'item.No == "xxx"'. The error returned was 'Evaluation of method System.String.op_Equality() calls into native method System.Environment.FailFast(). Evaluation of native methods in this context is not supported.'.

Additional notes

I tried finding a similar issue in this repo, but I couldn't find any. However, I found this issue which is filed under Visual Studio 2017 15.8, which I have installed (v15.8.9 to be specific).

Could it be that my VS 2017 15.8's debugger takes precedence over the debugger of Omnisharp? Is there a way to tell Omnisharp to use the one it's included with?

@gregg-miskelly
Copy link
Contributor

The C# debugger backend is mostly shared between VS and VS Code. So you are just running into the same bug in both debuggers.

@dubeg
Copy link
Author

dubeg commented Nov 14, 2018

@gregg-miskelly Oh! Okay. And I guess there's no way to downgrade the version of the debugger.

Also, just noticed that it doesn't always fail. It seems the conditions are very specific.
Here's a minimum repro. The conditional breakpoint is on the Console.Write(str) line.

using System;
using System.Collections.Generic;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            // var str = "AAAAAAAAA"; // Works
            var str = "AAAAAAAA1"; // Fails
            // Expression: str == "AAAAAAAAA"
            Console.Write(str);
        }
    }
}

The condition for a breakpoint failed to execute. The condition was 'str == "AAAAAAAAA"'. The error returned was 'Evaluation of method System.String.op_Equality() calls into native method System.CLRConfig.GetConfigBoolValue(). Evaluation of native methods in this context is not supported.'.

@gregg-miskelly
Copy link
Contributor

Note for anyone reading this, here are the two VS Feedback tickets that also reference the same underlying issue:

@gregg-miskelly
Copy link
Contributor

This is now fixed in 1.18.

@ddobric
Copy link

ddobric commented Feb 11, 2020

Sorry, still have the same issue:

Microsoft Visual Studio Enterprise 2019
Version 16.4.5

image

@JoeRobich
Copy link
Member

Hi @ddobric, You can report Visual Studio issues using "Send Feedback" from the top right corner of Visual Studio. This repository is strictly for the C# extension for VS Code.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants