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
228 stars 12 forks source link

[BUG] Buggy while debugging #299

Closed wV-software closed 1 year ago

wV-software commented 1 year ago

Describe the Issue

Debugging was working for the first few times. Afterwards and without any change in extensions installed nor settings or configuration, I'm getting the following message every time I try to debug any C# app. image

Steps To Reproduce

I Can't even get back to the original state of debugging normally in the first place.

Expected Behavior

The debugging should work normally

Environment Information

OS: Windows 10 VS Code Version: 1.80.2 Extension Version: C# Dev Kit v0.3.18

timheuer commented 1 year ago

@wV-software If you open a C# file and try debugging then do you get an error message? By default VSCode looks for a debugger that can work with the active document open (which looks like you have launch.json open). If you are using launch.json/task.json however to configure your debugging, can you share the contents of them to validate the config?

wV-software commented 1 year ago

@timheuer Thank you for response first. Actually I did some homework to get back to you with some useful information, please find the steps below to regenerate the issue:

  1. I was installing .net sdk v8.0.100-preview, when I got that error. C:\Users\George>dotnet --list-sdks 1.1.0 [C:\Program Files\dotnet\sdk] 1.1.11 [C:\Program Files\dotnet\sdk] 1.1.13 [C:\Program Files\dotnet\sdk] 1.1.14 [C:\Program Files\dotnet\sdk] 2.0.2 [C:\Program Files\dotnet\sdk] 2.1.202 [C:\Program Files\dotnet\sdk] 2.1.300-preview1-008174 [C:\Program Files\dotnet\sdk] 2.1.500 [C:\Program Files\dotnet\sdk] 2.1.505 [C:\Program Files\dotnet\sdk] 2.1.508 [C:\Program Files\dotnet\sdk] 2.1.801 [C:\Program Files\dotnet\sdk] 2.2.101 [C:\Program Files\dotnet\sdk] 3.1.406 [C:\Program Files\dotnet\sdk] 5.0.202 [C:\Program Files\dotnet\sdk] 7.0.306 [C:\Program Files\dotnet\sdk] 7.0.400-preview.23330.10 [C:\Program Files\dotnet\sdk] 8.0.100-preview.6.23330.14 [C:\Program Files\dotnet\sdk]

  2. I reverted back to an old image of the whole system to make a clean installation of the frameworks one by one.

  3. I Started by .net SDK 7, which is the version used by the projects inside the solution. And by re-checking the issue, debugging is going very well.

  4. I installed SDK v8-preview, then tried to debug, I got the issue again. Please find below a snippet of the DEBUG CONSOLE output which indicates that, .net 8-preview was inadvertently used instead of .net7 although the solution projects set the .net version to 7. `------------------------------------------------------------------- You may only use the Microsoft .NET Core Debugger (vsdbg) with Visual Studio Code, Visual Studio or Visual Studio for Mac software to help you develop and test your applications.

    Using launch settings from 'G:_MyProjects___dotWire\Dotwire\BlazorWasm\Properties\launchSettings.json' [Profile 'https']... Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\8.0.0-preview.6.23329.7\System.Private.CoreLib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. Loaded 'C:\Program Files\dotnet\sdk\8.0.100-preview.6.23330.14\dotnet.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

    net7.0 enable enable

` I wish this is helpful, please don't hesitate to ask me for anything missing

timheuer commented 1 year ago

Thanks for the additional info @wV-software! Once you have the highest SDK installed this is expected it is used for your project (it doesn't change your projects target though).

After installing .NET 8 preview you mentioned you are getting the issue again. Is the issue in this case the dialog?

wV-software commented 1 year ago

@timheuer Thanks for reply. Yes, but it's supposed to use the same version mentioned in the .csproj file not the latest, by design. And this is the behavior using any other IDE, Visual Studio, Rider, ... etc.. Actually using a higher version especially the preview version, broke the debugging at all. Another bit of info, by uninstalling .net 8 preview I couldn't get back to normal debugging, and I had to revert my system to a check point to overcome this situation.

wV-software commented 1 year ago

Answering your question, no it's not just the dialog. Debugging would not work at all.

timheuer commented 1 year ago

Yes, but it's supposed to use the same version mentioned in the .csproj file not the latest, by design

Runtime and SDK are different. If you have the .NET 8 SDK installed and you are building any .NET app, it's going to use the .NET 8 SDK unless you have 'pinned' an SDK version (global.json). This is by design. An SDK can build other version apps. Just because the v8 SDK is being used won't make it a v8 app though, it still honors the TFM in csproj.

But the debugging is problematic and we'll have to see what's going on. I suspect this is something macOS related. I'm just not seeing this.

wV-software commented 1 year ago

No, I'm working on windows.

timheuer commented 1 year ago

No, I'm working on windows.

Doh, sorry I was confusing another bug :-) apologies.

I just saw you closed this -- resolved now?