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
192 stars 6 forks source link

Debugger exits while stepping through code #1070

Open mmiller-d8 opened 3 weeks ago

mmiller-d8 commented 3 weeks ago

Type: Bug

Almost every single time I try to step through code in a Maui shell app, the debugger just goes away. I hit step-over and the highlighted line just goes away and the app stops responding to input.

It can be on completely innocuous lines of code. There is no crash, no error message, nothing to indicate that anything is wrong. It just stops. Often it is after just one or two lines of code.

It's as if the debugger goes off waiting for the line of code to execute and never comes back. Kind of like if you have an async method and you needed to use ConfigureAwait(false) but didn't. Only this doesn't have to have an async method to happen.

I have not seen this happen in ASP.Net, just Maui. I also want to say that this is just since the last update. It worked fine before that.

EDIT: By "Last Update," I mean that I updated to .net 8.0.201 after I updated the community toolkit to find that it forced a .net 8 upgrade. Very bad form, by the way. I also had to update the workloads, so it isn't completely clear for me which thing broke it.

Extension version: 0.10.61 VS Code version: Code 1.88.1 (e170252f762678dec6ca2cc69aba1570769a5d39, 2024-04-10T17:43:08.196Z) OS version: Darwin arm64 23.4.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M3 Max (14 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|3, 4, 4| |Memory (System)|96.00GB (4.46GB free)| |Process Argv|--crash-reporter-id 1618046c-b005-4c1a-89ae-cb627902572c| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 vstes627:30244334 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:30899288 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pyreplss1:30897532 pythonmypyd1:30879173 pythoncet0:30885854 2e7ec940:31000449 pythontbext0:30879054 accentitlementsc:30995553 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 8082a590:30971561 fegfb526:30981948 bg6jg535:30979843 ccp1r6:30993540 dsvsc020:30976470 pythonait:31006305 gee8j676:31009558 dsvsc021:30996838 0ee40948:31013168 ```

| VS Bug 2049457

sumowesley commented 3 weeks ago

I don't know if this helps, but we upgraded our M1 Macbook Air system to .NET 8.0.204 yesterday. Since then, it would start a Maui app but the debug controls would disappear and we never hit a breakpoint. Reverting to .NET 8.0.104 has brought back the debugger controls and the breakpoints work.

VS Code: 1.88.1 .NET MAUI extension: 0.11.16 macOS: Sonoma 14/4/1 Chip: Apple M1

mauroa commented 3 weeks ago

Hi @sumowesley. Does this happen with a specific MAUI app or with any MAUI app, including a new one?

We've introduced a new debug engine for MAUI apps on latest pre-release versions of .NET MAUI and C#, that is supported from .NET SDK 8.0.200, which is the same debug engine used by non-MAUI apps and also by Windows apps. You should have a better and improved debug experience with the versions you mentioned, not a worse one.

If you can update .NET 8 again (to a version > 8.0.200), ensuring to have new versions (pre-release) of .NET MAUI and C#, can you confirm if you see differences between these 2 scenarios?

1 - Go to the VS Code Settings, in the ‘User’ tab go to ‘Extensions > .NET MAUI’ and uncheck the "Use VSDbg" option

2 - Go to the VS Code Settings, in the ‘User’ tab go to ‘Extensions > .NET MAUI’ and check the "Use VSDbg" option

The checkbox checked means you are using the new debugger, whereas unchecked means you are using the old one. It would be good to know if you notice differences and if you have issues with one engine but not with the other.

Thank for your help.

sumowesley commented 3 weeks ago

Hi @mauroa,

When we tried it last week, the debugger didn't work on a brand new Maui project or our main development here.

I've just swapped .net directories to revert to 8.0.204.

Dotnet:

Extensions:

The new MAUI project from last week works with VSDbg. However, our larger project does not work with VSDbg; it does work when I disable VSDbg from the extension settings.

Let me know if you need any more.

mmiller-d8 commented 3 weeks ago

@mauroa

I checked mine, and it was already checked. I unchecked it and was able to step through code as I could before. When I checked it again, I was able to step through a lot more lines of code (a dozen or more) before it showed the same behavior - the debugger function stopping and the app not responding to input.

github-actions[bot] commented 3 weeks ago

@mauroa, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.

mauroa commented 2 weeks ago

@sumowesley @mmiller-d8 any chance you can privately share your projects? That would help identifying what could be making the debugger to fail at some point. Thanks

sumowesley commented 2 weeks ago

@mauroa, I've added you to the relevant repository. The MAUI project is MossUI.

mmiller-d8 commented 2 weeks ago

If you don't mind, I'd like to wait to see if you can reproduce it with the one @sumowesley provided. Mine isn't quite in a state where you can run it at the moment. Not without deploying the API locally. If you can't repro it with his, I'll deploy my API to azure and give you a branch that's pointed at it.

github-actions[bot] commented 2 weeks ago

@mauroa, the 'needs-more-info' label has been removed upon receiving further response from the original bug filer.