question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Debugging Unit Test loses codelens Run Test / Debug Test - DebugSessionManager does not stop

See original GitHub issue

Related to #1743

Environment data

dotnet --info output:

.NET Core SDK (reflecting any global.json): Version: 2.1.301 Commit: 59524873d6

Runtime Environment: OS Name: Windows OS Version: 10.0.17134 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.301\

Host (useful for support): Version: 2.1.1 Commit: 6985b9f684

.NET Core SDKs installed: 1.0.4 [C:\Program Files\dotnet\sdk] 2.0.2 [C:\Program Files\dotnet\sdk] 2.0.3 [C:\Program Files\dotnet\sdk] 2.1.2 [C:\Program Files\dotnet\sdk] 2.1.3 [C:\Program Files\dotnet\sdk] 2.1.4 [C:\Program Files\dotnet\sdk] 2.1.100 [C:\Program Files\dotnet\sdk] 2.1.101 [C:\Program Files\dotnet\sdk] 2.1.102 [C:\Program Files\dotnet\sdk] 2.1.103 [C:\Program Files\dotnet\sdk] 2.1.104 [C:\Program Files\dotnet\sdk] 2.1.105 [C:\Program Files\dotnet\sdk] 2.1.200 [C:\Program Files\dotnet\sdk] 2.1.201 [C:\Program Files\dotnet\sdk] 2.1.300 [C:\Program Files\dotnet\sdk] 2.1.301 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 1.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 1.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 2.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download PS D:\CBRock\XCellorator>

VS Code version: 1.24.1 C# Extension version: ms-vscode.csharp-1.15.2.omnisharp\1.30.1\OmniSharp.exe

Steps to reproduce

Create a TestServer that has a IHostedService with dependencies and do not perform a graceful close on the TestServer using the following code: this.testServerIam.Host.StopAsync().GetAwaiter().GetResult();. The OmniSharp.DotNetTest.DebugSessionManager will never report “Debug session ended”, it will be stuck with “Debug session started.”, even though the .NET Test Log says Debugging complete. The extra host process not being cleaned up / shutdown must be confusing omnisharp. In some cases the codelens may appear on a fresh restart but clicking the debug again will just hang with the debug starting in the output window (it will never start).

Expected behavior

Omnisharp debug session stops, codelens run/debug appears and a subsequent debug can be performed.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:57 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
schaveytcommented, Mar 13, 2020

Still exists as an issue for me as well.

3reactions
seesharpercommented, Dec 11, 2018

@rchande @akshita31 @vhetet

I discovered something that might be useful.

In the repro project https://github.com/seesharper/Omnisharp-WebApi

If I run the test with the solution loaded, meaning both the test project and the webapi project, the test causes death to OmniSharp. Note that the test project does not even reference the web api project.

Now, If I open ONLY the test project, the test runs fine in debug mode.

So maybe it is related to what assemblies are being fed into the debugger or something in that direction?

When I think about this, the problem has been mostly prominent on project involving AspNetCore

UPDATE.

I managed to get it to fail even when loading just the test project, but I had to run the test(debug) like 20 times for it to fail. Could it be a memory thing? Or simply a timing issue somewhere?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Debug / Run part of unit test CodeLens for is not showing
Create new unit test project, build it. ... This issue is read only, because it has been in the Closed - Fixed state...
Read more >
Visual Studio Code's "Run Test | Debug Test" option missing ...
Check your options to confirm that the Go test explorer is enabled: Preferences > Settings > User Settings > find "go test enable...
Read more >
Debug your tests in TypeScript with Visual Studio Code
Debug individual tests written in TypeScript with Visual Studio Code with the help ... Run will only run the test with no debugger...
Read more >
Debug unit tests with Test Explorer - Visual Studio (Windows)
You can use Test Explorer to start a debugging session for your tests. Stepping through your code with the Visual Studio debugger seamlessly ......
Read more >
Interactive Unit Testing with .NET Core and VS Code
NET 5 will be upon us and it's crucial to keep our knives sharpened on the latest technology from Microsoft. How do you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found