dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.87k stars 675 forks source link

Unable to evaluate some expressions in debugger #3770

Open koliyo opened 4 years ago

koliyo commented 4 years ago

Issue Description

In last period of time I am now frequently getting problems looking at values and evaluating expressions in the VS Code debugger.

I have not seen this previously, it started occurring in the last month or so. Think it is related to some .NET/OmniSharp update?

When trying to evaluate expressions in the debug console, or in the debug variable viewer I often get

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

This is not native code, and I never saw these issues before.

Also not, that it is not fully deterministic, sometimes after restarting the debug session, and reaching the same breakpoint it sometimes start working properly :/

I have verified that my libraries are loaded from the Debug directory, so they should not be release build assemblies.

Steps to Reproduce

Not sure

Expected Behavior

Be able to evaluate expressions

Actual Behavior

Some expressions/properties are not inspectable during debugging.

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.45.0 C# Extension: 1.21.18

Mono Information OmniSharp using built-in mono
Dotnet Information .NET Core SDK (reflecting any global.json): Version: 3.1.201 Commit: b1768b4ae7 Runtime Environment: OS Name: Mac OS X OS Version: 10.14 OS Platform: Darwin RID: osx.10.14-x64 Base Path: /usr/local/share/dotnet/sdk/3.1.201/ Host (useful for support): Version: 3.1.3 Commit: 4a9f85e9f8 .NET Core SDKs installed: 3.1.201 [/usr/local/share/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions |Extension|Author|Version| |---|---|---| |auto-close-tag|formulahendry|0.5.7| |auto-comment-blocks|kevinkyang|1.0.1| |auto-rename-tag|formulahendry|0.1.2| |auto-using|Fudge|0.7.15| |autodocstring|njpwerner|0.5.1| |better-toml|bungcip|0.3.2| |blazorsnippets|ScottSauber|1.3.0| |bracket-pair-colorizer-2|CoenraadS|0.1.1| |brick|koliyo|0.1.0| |camelcasenavigation|maptz|1.1.1| |change-case|wmaurer|1.0.0| |cmake|twxs|0.0.17| |cmake-tools|ms-vscode|1.3.1| |code-file-nav|jakelucas|0.7.2| |code-runner|formulahendry|0.10.0| |code-settings-sync|Shan|3.4.3| |cpptools|ms-vscode|0.28.0-insiders2| |csharp|ms-dotnettools|1.21.18| |dart-code|Dart-Code|3.10.1| |debugger-for-chrome|msjsdiag|4.12.6| |dhall-lang|panaeon|0.0.4| |dotenv|mikestead|1.0.1| |dotnet-core-essentials|KishoreIthadi|0.0.8| |dotnet-test-explorer|formulahendry|0.7.1| |dotnetexplorer|mfery|1.0.0| |ginfuru-vscode-jekyll-syntax|ginfuru|0.1.1| |gitlens|eamodio|10.2.1| |Go|ms-vscode|0.14.1| |gradle-language|naco-siren|0.2.3| |hjson|laktak|0.3.2| |insert-unicode|brunnerh|0.8.0| |java|redhat|0.61.0| |jinjahtml|samuelcolvin|0.13.0| |json-schema-validator|tberman|0.1.0| |jsonnet|heptio|0.1.0| |jumpprotobuf|ldcf4|0.0.3| |kotlin|fwcd|0.2.11| |language-julia|julialang|0.15.29| |language-prometheus|caarlos0|0.1.2| |language-stylus|sysoev|1.11.0| |lit-html|bierner|1.11.1| |lsp-inspector-webview|octref|0.0.2| |markdown-all-in-one|yzhang|2.8.0| |material-theme|zhuangtongfa|3.4.0| |mono-debug|ms-vscode|0.15.8| |nim|kosz78|0.6.6| |notes|canadaduane|1.0.0| |npm-intellisense|christian-kohler|1.3.0| |prettify-json|mohsen1|0.0.3| |project-manager|alefragnani|10.12.0| |python|ms-python|2020.4.76186| |QML|bbenoist|1.0.0| |remote-containers|ms-vscode-remote|0.112.0| |remote-ssh|ms-vscode-remote|0.51.0| |remote-ssh-edit|ms-vscode-remote|0.51.0| |restructuredtext|lextudio|126.0.0| |rust|rust-lang|0.7.5| |scriban|xoofx|1.1.0| |shader|slevesque|1.1.4| |swig-tpl|zhangciwu|0.0.6| |terraform|mauve|1.4.0| |tslint|eg2|1.0.44| |vetur|octref|0.24.0| |vscode-color|anseki|0.4.5| |vscode-docker|ms-azuretools|1.1.0| |vscode-eslint|dbaeumer|2.1.5| |vscode-fileutils|sleistner|3.0.1| |vscode-graphql|Prisma|0.2.14| |vscode-icons|vscode-icons-team|10.1.1| |vscode-jekyll-snippets|ginfuru|0.9.3| |vscode-jest|Orta|3.2.0| |vscode-journal|pajoma|0.10.0| |vscode-markdownlint|DavidAnson|0.35.1| |vscode-new-file|dkundel|4.0.2| |vscode-nginx|shanoor|0.6.0| |vscode-npm-script|eg2|0.3.11| |vscode-nuget-package-manager|jmrog|1.1.6| |vscode-open-in-github|ziyasal|1.3.6| |vscode-open-in-sublime-merge|morrislaptop|0.6.0| |vscode-paste-and-indent|Rubymaniac|0.0.8| |vscode-proto3|zxh404|0.4.2| |vscode-reveal|evilz|4.0.3| |vscode-test-explorer|hbenl|2.18.0| |vscode-theme-onedark|akamud|2.2.1| |vscode-yaml|redhat|0.7.2| |vscode-yarn|gamunu|1.7.0| |vscodeintellicode|VisualStudioExptTeam|1.2.7| |vsliveshare|ms-vsliveshare|1.0.2106| |vsnotes|patricklee|0.7.1| |vue-snippets|hollowtree|0.1.11|;
cartermp commented 4 years ago

@koliyo are you using .NET Core? The issue might stem from trying to debug an NGEN'd assembly.

koliyo commented 4 years ago

Yes, this is .NET Core. I am running this on Mac OSX.

These are my build parameters

    <TargetFrameworks>netcoreapp3.1; netstandard2.1</TargetFrameworks>
    <ProcessorArchitecture>amd64</ProcessorArchitecture>
    <Platform>x64</Platform>

    <!-- https://github.com/dotnet/core/blob/master/release-notes/3.1/3.1.2/3.1.2.md#macos-notarization-change -->
    <UseAppHost>true</UseAppHost>
    <LangVersion>latest</LangVersion>