microsoft / vscode-dotnettools

This is a feedback repository to capture issues logged for the C# Dev Kit and related extensions from Visual Studio Code
Other
219 stars 9 forks source link

[BUG] When stepping through code, it randomly fails getting source file when selecting different frame in call stack #1029

Open matherm-aboehm opened 5 months ago

matherm-aboehm commented 5 months ago

Describe the Issue

When Debugger stops at a breakpoint and you try to select an earlier frame from the call stack which is inside .NET runtime code, then VSCode shows a message that it failed at requesting the file (see Screenshot). VSCode_CS_DevKit_error Output log:

[Error - 12:57:08] Document pull failed for text document debug:https%3A//raw.githubusercontent.com/dotnet/runtime/1381d5ebd2ab1f292848d5b19b80cf71ac332508/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs?session%3D64339a21-1cf8-40ac-bcb8-1df9073e3db6%26ref%3D1000000004 Message: Unsupported extension '.cs?session=64339a21-1cf8-40ac-bcb8-1df9073e3db6&ref=1000000004' and LSP language id '' Code: -32000 [object Object] [Error - 13:03:21] Request textDocument/diagnostic failed.

Steps To Reproduce

  1. .vscode/settings.json
    {
    "editor.quickSuggestions": {
        "comments": "on",
        "strings": "on",
        "other": "on"
    },
    "editor.suggestOnTriggerCharacters": true,
    "editor.codeActionsOnSave": {
        "source.organizeImports": "explicit"
    },
    "omnisharp.enableRoslynAnalyzers": true,
    "omnisharp.enableEditorConfigSupport": true,
    "csharp.debug.justMyCode": false,
    "csharp.debug.suppressJITOptimizations": true,
    "csharp.debug.symbolOptions.cachePath": "D:\\Symbols",
    "csharp.debug.symbolOptions.searchMicrosoftSymbolServer": true,
    "csharp.debug.symbolOptions.searchNuGetOrgSymbolServer": true,
    "csharp.debug.symbolOptions.searchPaths": [
        "D:\\RefSrc\\Symbols\\",
        "C:\\WINDOWS\\symbols\\",
        "http://referencesource.microsoft.com/symbols"
    ],
    "csharp.debug.symbolOptions.moduleFilter.mode": "loadAllButExcluded"
    }
  2. Create a new simple C# Console App .NET Core project with attached .txt file as content of a .cs file. vscode-dotnettools-issue.txt
  3. Set a breakpoint in the callback handler, so that the Debugger breaks when something from .NET class library calls own code.
  4. Hit run and debug in a fresh VSCode session, so cached downloads don't hide the issue.
  5. Try to select an earlier frame from call stack where the code file needs to be downloaded from GitHub, e.g. "System.Private.CoreLib.dll!System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent..."
  6. See the error message.

Expected Behavior

No error, just open downloaded code file.

Environment Information

lwansbrough commented 1 month ago

I received this error when attempting to step into a nuget package with a similar configuration to what is shown, so this is reproducible in more than one way. In fact I was able to step into it once, but stepping further into the package failed with the error shown above.