.NET 6 preview - debugging tests with breakpoints removes testing code lens support
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 737
- Avg merge
- 18h 40m
- Merged PRs (30d)
- 31
Description
## Issue Description ##
With Xunit tests in .NET 6 preview 7, if you debug a test where you will hit a breakpoint then when the test is done all the unit test code lens support is gone.
Before running the test:

After running the test:

**The important key is that there has to be a breakpoint.** If there's no breakpoint hit, then using the `Debug Test` or `Debug All Tests` code lens thing works just fine. If you hit a breakpoint, then after the test run is complete these will stop working.
## Steps to Reproduce ##
- Create a .NET 6 preview 7 class library assembly.
- Create a .NET 6 preview 7 Xunit project that references the class library.
- Set up an Xunit test that calls something in the class library.
- Set a breakpoint in the class library.
- Use the `Debug Test` code lens to start a debug session. Let it hit the breakpoint in the class library. Step over an instruction or something, then let the test finish.
- When the test run is done, the code lens (if it's still showing) will no longer work. If you close the test fixture file and reopen it, the code lenses won't be there.
## Expected Behavior ##
The code lens should remain and should still work.
## Actual Behavior ##
Either the code lens disappears entirely or it may still display but be unclickable. Closing the test fixture file and reopening it will show that the code lens is definitely gone.
## Logs ##
### OmniSharp log ###
File paths slightly anonymized.
```text
Starting OmniSharp server at 9/14/2021, 10:31:10 AM
Target: /Users/tillig/dev/dn/my-project/MySolution.sln
OmniSharp server started with Mono 6.12.0.
Path: /Users/tillig/.vscode/extensions/ms-dotnettools.csharp-1.23.15/.omnisharp/1.37.15/omnisharp/OmniSharp.exe
PID: 9682
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on MacOS 11.5.2 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Mono 16.10.1 - "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin"
2: StandAlone 17.0.0 - "/Users/tillig/.vscode/extensions/ms-dotnettools.csharp-1.23.15/.omnisharp/1.37.15/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Mono 16.10.1 - "/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin"
CscToolExe = csc.exe
CscToolPath = /Users/tillig/.vscode/extensions/ms-dotnettools.csharp-1.23.15/.omnisharp/1.37.15/omnisharp/.msbuild/Current/Bin/Roslyn
[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 '/Users/tillig/dev/dn/my-project'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Detecting projects in '/Users/tillig/dev/dn/my-project/MySolution.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/Users/tillig/dev/dn/my-project'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/Users/tillig/dev/dn/my-project' on host 9584.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProject
[info]: OmniSharp.MSBuild.ProjectManager
Update project: MyProject.Test
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 35.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/codestructure but could not find request.
Received response for /quickinfo but could not find request.
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/Users/tillig/dev/dn/my-project/src/MyProject/MyProject.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/Users/tillig/dev/dn/my-project/test/MyProject.Test/MyProject.Test.csproj'.
[info]: OmniSharp.DotNetTest.VSTestManager
read: {"MessageType":"TestSession.Connected","Payload":null}
[info]: OmniSharp.DotNetTest.VSTestManager
read: {"MessageType":"ProtocolVersion","Payload":1}
[info]: OmniSharp.DotNetTest.DebugSessionManager
Debug session started.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/codestructure but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/getcodeactions but could not find request.
```
### C# log ###
The C# log is empty.
## Environment information ##
**VSCode version**: 1.60.0
**C# Extension**: 1.23.15
Mono Information
OmniSharp using global mono :6.12.0
Dotnet Information
.NET SDK (reflecting any global.json):
Version: 6.0.100-preview.7.21379.14
Commit: 22d70b47bc
Runtime Environment:
OS Name: Mac OS X
OS Version: 11.0
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100-preview.7.21379.14/
Host (useful for support):
Version: 6.0.0-preview.7.21377.19
Commit: 91ba01788d
.NET SDKs installed:
3.1.412 [/usr/local/share/dotnet/sdk]
5.0.400 [/usr/local/share/dotnet/sdk]
6.0.100-preview.7.21379.14 [/usr/local/share/dotnet/sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.18 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.7.21378.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.18 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.7.21377.19 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Visual Studio Code Extensions
|Extension|Author|Version|
|---|---|---|
|auto-close-tag|formulahendry|0.5.12|
|auto-rename-tag|formulahendry|0.1.8|
|azure-account|ms-vscode|0.9.8|
|beautify|HookyQR|1.5.0|
|better-comments|aaron-bond|2.1.0|
|better-toml|bungcip|0.3.2|
|code-spell-checker|streetsidesoftware|2.0.4|
|color-info|bierner|0.7.0|
|cpptools|ms-vscode|1.6.0|
|csharp|ms-dotnettools|1.23.15|
|cucumberautocomplete|alexkrechik|2.15.1|
|docomment|k--kato|0.1.20|
|dotenv|mikestead|1.0.1|
|dotnet-test-explorer|formulahendry|0.7.7|
|ecdc|mitchdenny|1.4.0|
|EditorConfig|EditorConfig|0.16.4|
|fabric8-analytics|redhat|0.3.3|
|git-extension-pack|donjayamanne|0.1.3|
|git-graph|mhutchie|1.30.0|
|githistory|donjayamanne|0.6.18|
|gitignore|codezombiech|0.7.0|
|gitlens|eamodio|11.6.0|
|go|golang|0.27.2|
|guides|spywhere|0.9.3|
|html-css-class-completion|Zignd|1.20.0|
|java|redhat|0.81.0|
|jupyter|ms-toolsai|2021.8.2041215044|
|jupyter-keymap|ms-toolsai|1.0.0|
|jwt-debugger|yokawasa|0.4.2|
|markdown-all-in-one|yzhang|3.4.0|
|markdown-emoji|bierner|0.2.1|
|material-theme|zhuangtongfa|3.11.4|
|metals|scalameta|1.10.9|
|msbuild-project-tools|tintoy|0.3.15|
|nc-gcode|ML|0.13.0|
|npm-intellisense|christian-kohler|1.4.0|
|output-colorizer|IBM|0.1.2|
|path-intellisense|christian-kohler|2.4.0|
|plantuml|jebbs|2.15.1|
|polacode|pnp|0.3.4|
|powershell|ms-vscode|2021.9.0|
|prettier-toml|bodil|0.1.0|
|project-manager|alefragnani|12.4.0|
|python|ms-python|2021.9.1230869389|
|rainbow-csv|mechatroner|1.9.1|
|remote-containers|ms-vscode-remote|0.194.0|
|remote-ssh|ms-vscode-remote|0.65.7|
|remote-ssh-edit|ms-vscode-remote|0.65.7|
|remote-wsl|ms-vscode-remote|0.58.2|
|remotehub|GitHub|0.14.0|
|restructuredtext|lextudio|165.0.0|
|rewrap|stkb|1.14.0|
|scala|scala-lang|0.5.4|
|sort-lines|Tyriar|1.9.0|
|spectral|stoplight|0.2.5|
|terraform|hashicorp|2.14.0|
|todo-tree|Gruntfuggly|0.0.214|
|vscode-arduino|vsciot-vscode|0.4.4|
|vscode-azureresourcegroups|ms-azuretools|0.4.0|
|vscode-code-review|d-koppenhagen|1.29.1|
|vscode-commons|redhat|0.0.6|
|vscode-coverage-gutters|ryanluker|2.8.1|
|vscode-docker|ms-azuretools|1.16.1|
|vscode-eslint|dbaeumer|2.1.25|
|vscode-graphviz|joaompinto|0.0.6|
|vscode-icons|vscode-icons-team|11.6.0|
|vscode-java-debug|vscjava|0.35.0|
|vscode-java-dependency|vscjava|0.18.7|
|vscode-java-pack|vscjava|0.18.4|
|vscode-java-test|vscjava|0.31.3|
|vscode-json-stable-stringify|TravisIllig|1.2.1|
|vscode-kubernetes-tools|ms-kubernetes-tools|1.3.3|
|vscode-markdownlint|DavidAnson|0.43.2|
|vscode-maven|vscjava|0.33.0|
|vscode-npm-script|eg2|0.3.22|
|vscode-open-in-github|ziyasal|1.3.6|
|vscode-openapi|42Crunch|4.6.3|
|vscode-pylance|ms-python|2021.9.1|
|vscode-remote-extensionpack|ms-vscode-remote|0.21.0|
|vscode-xml|redhat|0.18.0|
|vscode-yaml|redhat|0.22.0|
|vscodeintellicode|VisualStudioExptTeam|1.2.14|
|xml|DotJoshJohnson|2.5.1|
|yaml-plus-json|hilleer|1.8.0|;
Contributor guide
Assessment
This issue has not been assessed yet.