Open m-brooks opened 3 years ago
I've just realised a major part of what's wrong here, and that bit is my own stupid fault. However, there is still an issue to be addressed. The mistake I made was to set a breakpoint on a variable definition with implicit initialisation. This does not compile to any executable instructions, but instead merely reserves and initialises memory. Consequently it is not an appropriate target for a breakpoint - I'm way too old to be making mistakes like that, or so I'd have thought... However, this has exposed an issue. What should have happened in this scenario is that omnisharp should have automatically corrected my mistake by moving the breakpoint to the next appropriate line of source code (as I've seen in the past when working in Visual Studio), and then stopped at that breakpoint. What actually happened was confusion - one part of the debugging environment stopped and another part didn't (which indicates to me that we have at least two concurrent threads sharing the debugging load). So there's still something that needs to be fixed - it just isn't exactly as I first thought.
Regards, Michael
Issue Description
Code window behaviour does not match actual runtime behaviour whilst debugging.
Steps to Reproduce
I have just installed dotnet-script on my W10 system and used the command "dotnet-script init" to create a basic "Hello World" CSX project. I replaced the default with a simple 3-line script that creates two integer variables and then outputs their sum, set a breakpoint on the 1st line and hit F5. What I get is really weird - the code window appears as though execution has stopped on my breakpoint, but the debug window shows that the code has already run through to completion and output the result. If I hit F10 or use the mouse to click the "step over" button, the code window then immediately reflects the fact that the code has completed (i.e. it goes back to basic editor mode).
Expected Behavior
Execution pauses at breakpoint.
Actual Behavior
Code window gives the appearance that execution has paused at the breakpoint, but in reality the code has run all the way from start to finish. See scereenshot.
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.56.0 C# Extension: 1.23.11
Dotnet Information
.NET SDK (reflecting any global.json): Version: 5.0.104 Commit: ca6b6acadb Runtime Environment: OS Name: Windows OS Version: 10.0.19042 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\5.0.104\ Host (useful for support): Version: 5.0.5 Commit: 2f740adc14 .NET SDKs installed: 2.1.523 [C:\Program Files\dotnet\sdk] 3.1.301 [C:\Program Files\dotnet\sdk] 3.1.408 [C:\Program Files\dotnet\sdk] 5.0.102 [C:\Program Files\dotnet\sdk] 5.0.104 [C:\Program Files\dotnet\sdk] .NET runtimes installed: Microsoft.AspNetCore.All 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.27 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 3.1.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] To install additional .NET runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |csharp|ms-dotnettools|1.23.11|;