dotnet / dotnet/vscode-csharp

Bizarre breakpoint behaviour in VSCode

Open
#4,544 1 comment 0 reactions 0 assignees View on GitHub
Debugger OmniSharp
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## 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.
![CSX breakpoint](https://user-images.githubusercontent.com/35042732/117578827-2b486c80-b0e8-11eb-962a-1e49b1f634a2.png)

## Logs ##

### OmniSharp log ###
Starting OmniSharp server at 09/05/2021, 14:38:41
Target: c:\Dev\CSX\play1

OmniSharp server started.
Path: c:\Users\micha\.vscode\extensions\ms-dotnettools.csharp-1.23.11\.omnisharp\1.37.8\OmniSharp.exe
PID: 21320

[info]: OmniSharp.Stdio.Host
Starting OmniSharp on Windows 6.2.9200.0 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2019 16.8.30907.101 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
2: StandAlone 16.9.0 - "c:\Users\micha\.vscode\extensions\ms-dotnettools.csharp-1.23.11\.omnisharp\1.37.8\.msbuild\Current\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2019 16.8.30907.101 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
[info]: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
[info]: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Dev\CSX\play1'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\Dev\CSX\play1'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Dev\CSX\play1'.
[info]: OmniSharp.Script.ScriptProjectSystem
Found 1 CSX files.
[info]: OmniSharp.Script.ScriptContextProvider
Searching for compilation dependencies with the fallback framework of 'net5.0'.
[info]: OmniSharp.Script.ScriptProjectSystem
Added CSX project 'c:\Dev\CSX\play1\main.csx' to the workspace.
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Dev\CSX\play1' on host 14484.
Received response for /findusages but could not find request.
Received response for /findusages but could not find request.

### C# log ###
N/A - there is none

## 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-download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|csharp|ms-dotnettools|1.23.11|;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.