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.

Unable to execute Debug Test (specific scenario)

See original GitHub issue

Environment data

dotnet --info output:

.NET Command Line Tools (2.1.105)

Product Information:
 Version:            2.1.105
 Commit SHA-1 hash:  141cc8d976

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.1.105/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.7
  Build    : 2d61d0b043915bc948ebf98836fefe9ba942be11

VS Code version: 1.23.1 C# Extension version: 1.15.0

Steps to reproduce

We’ll need a project with subprojects referenced in .csproj with $(MSBuildStartupDirectory). The project above demonstrates this scenario: https://github.com/pfrozi/project-levels-test

  1. Debug any test via code lens (clicking on “debug test” above the method on UnitTest.cs).

Expected behavior

Debugger goes into the first breakpoint of a test method.

Actual behavior

Failed to start debugger: "System.NullReferenceException: Object reference not set to an instance of an object
  at OmniSharp.DotNetTest.TestManager.SendMessage[T] (System.String messageType, T payload) [0x0002d] in <33736a65aede4474bfe8b27847decd0c>:0 
  at OmniSharp.DotNetTest.VSTestManager+<DiscoverTestsAsync>d__12.MoveNext () [0x0003f] in <33736a65aede4474bfe8b27847decd0c>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at OmniSharp.DotNetTest.VSTestManager+<DebugGetStartInfoAsync>d__8.MoveNext () [0x0008c] in <33736a65aede4474bfe8b27847decd0c>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at OmniSharp.Endpoint.EndpointHandler`2+<HandleSingleRequest>d__18[TRequest,TResponse].MoveNext () [0x000e4] in <60d55a57d20c497d81259dcc806d3c60>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at OmniSharp.Endpoint.EndpointHandler`2+<Process>d__16[TRequest,TResponse].MoveNext () [0x0024b] in <60d55a57d20c497d81259dcc806d3c60>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <64d3ed9d91d947acb3a1d9bc1953eb73>:0 
  at OmniSharp.Stdio.Host+<HandleRequest>d__15.MoveNext () [0x0010d] in <f2607bf9829a436d80af1306ea7ea2cd>:0 "

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
akshita31commented, May 23, 2018

@pfrozi I used the git submodule update and cloned the two submodules. But I am certain now that there is a problem with the references here. The tests use the project-level1 project but the reference to them is not present in the csproj. I resolved all the necessary references with absolute paths and everything is working fine for me now. Could you try that ?

0reactions
akshita31commented, Oct 10, 2018

@pfrozi Glad you got it working 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't run or debug unit tests - Visual Studio Feedback
I'm using Visual Studio Community Edition 15.8.1 and I can't run or debug any unit tests. Every time I'm trying to run the...
Read more >
Debug Tests Fails with "Multiple scenarios are not supported"
A 'Debug Test' only supports running with one engine. When executing a test, each scenario defined requires its own dedicated engine, which means...
Read more >
Visual Studio - suddenly cannot debug tests - Stack Overflow
Solution: Select 'Debug Unit Tests' or 'Run Unit Tests' instead of 'Debug Tests' or ' ...
Read more >
Unable to run/debug unit tests · Issue #3313 · microsoft/PTVS
I consistently run into issues while debugging unit tests where: The test will either continue to run after it's been cancelled or has...
Read more >
Debug unit tests with Test Explorer - Visual Studio (Windows)
In the Visual Studio editor, set a breakpoint in one or more test methods that you want to debug. Note. Because test methods...
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