Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger: Failed to debug Xunit project when start debugging again #1413

Closed
GraceDong opened this issue Apr 21, 2017 · 3 comments
Closed

Debugger: Failed to debug Xunit project when start debugging again #1413

GraceDong opened this issue Apr 21, 2017 · 3 comments
Assignees
Milestone

Comments

@GraceDong
Copy link

GraceDong commented Apr 21, 2017

Environment data

dotnet --info output:

  • OS Name: debain
  • OS Version: 8
  • OS Platform: Linux
  • RID: debian.8-x64
  • Base Path: /opt/dotnet/sdk/1.0.1

VS Code version: v1.11.2
C# Extension version: v1.9.0

Steps to reproduce

  1. Open attached folder with VSCode.
    test-xunit.zip
  2. Set a breakpoint at the line of 11 in UnitTest1.cs;
  3. Debug test;
  4. Debug test again

Expected behavior

Re-start debugging and the breakpoint should be hit again.

Actual behavior

Pop a error message as following:
xunit_error

Log: log.txt

@GraceDong GraceDong changed the title Debugger:[Random] Failed to debug Xunit project Debugger: Failed to debug Xunit project when start debuging again Apr 21, 2017
@GraceDong GraceDong changed the title Debugger: Failed to debug Xunit project when start debuging again Debugger: Failed to debug Xunit project when start debugging again Apr 21, 2017
@DustinCampbell
Copy link
Member

@GraceDong: Any chance you could provide the OmniSharp log when this happens? You can get it by selecting View- >Output and then choosing "OmniSharp Log" from the top-right corner of the Output pane.

@DustinCampbell
Copy link
Member

OK. I'm able to reproduce this on Debian 8. For me, it happens if perform the following task a few times in a row:

  1. Click "debug test"
  2. Hit breakpoint
  3. Press stop to end the debugging session.

Eventually, the debugger seems to get into a weird state and the debugger events never fire. That leaves OmniSharp in a bad state, which results in the "Failed to start debugger: null" message.

Below is the content of the .NET Test Log output channel from a reproduction of the issue. Note that there were three successful runs and then the debugger didn't reported that it had started the debugging process on the fourth run.

Debugging method 'test_xunit.UnitTest1.Test1'.
Started debugging process #6102.
[xUnit.net 00:00:01.7993819]   Starting:    test-xunit
The active test run was aborted. Reason: Unable to communicate with test host process.
Debugging complete.

Debugging method 'test_xunit.UnitTest1.Test1'.
Started debugging process #6269.
[xUnit.net 00:00:01.7056933]   Starting:    test-xunit
The active test run was aborted. Reason: Unable to communicate with test host process.
Debugging complete.

Debugging method 'test_xunit.UnitTest1.Test1'.
Started debugging process #6407.
[xUnit.net 00:00:01.6709782]   Starting:    test-xunit
The active test run was aborted. Reason: Unable to communicate with test host process.
Debugging complete.

Debugging method 'test_xunit.UnitTest1.Test1'.
Debugging method 'test_xunit.UnitTest1.Test1'.

Here's an OmniSharp log at this point. Note that there are a few successful test debugging sessions and then it gets horked:

[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.
[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session ended.
[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.
[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session ended.
[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.
[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session ended.
[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.
[info]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"TestSession.Connected","Payload":null}
[info]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"ProtocolVersion","Payload":1}
[fail]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session not started.
[fail]: Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware
        An unhandled exception has occurred: Debug session already started.
System.InvalidOperationException: Debug session already started.
  at OmniSharp.DotNetTest.DebugSessionManager.VerifySession (System.Boolean isStarted) [0x00055] in <7124f501081e464b97067a98f0b0e806>:0 
  at OmniSharp.DotNetTest.DebugSessionManager.StartSession (OmniSharp.DotNetTest.TestManager testManager) [0x00011] in <7124f501081e464b97067a98f0b0e806>:0 
  at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x0000d] in <7124f501081e464b97067a98f0b0e806>:0 
  at OmniSharp.Middleware.Endpoint.Exports.RequestHandlerExportHandler`2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <30afbacdd97f44c59c542cdbc3e6fa9a>:0 
  at OmniSharp.Middleware.Endpoint.EndpointHandler`2+<HandleSingleRequest>d__18[TRequest,TResponse].MoveNext () [0x00092] in <30afbacdd97f44c59c542cdbc3e6fa9a>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at OmniSharp.Middleware.Endpoint.EndpointHandler`2+<Process>d__16[TRequest,TResponse].MoveNext () [0x0025e] in <30afbacdd97f44c59c542cdbc3e6fa9a>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter`1[TResult].GetResult () [0x00000] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at OmniSharp.Middleware.EndpointMiddleware+<Invoke>d__7.MoveNext () [0x000d8] in <30afbacdd97f44c59c542cdbc3e6fa9a>:0 
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0004e] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <12e050e5b3d34326a1b4e2e7624e75da>:0 
  at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware+<Invoke>d__6.MoveNext () [0x00080] in <54abb6e5c34d41e5b18eb3ce35092c5b>:0

@DustinCampbell DustinCampbell self-assigned this Apr 21, 2017
@DustinCampbell DustinCampbell added this to the 1.9 milestone Apr 21, 2017
@DustinCampbell
Copy link
Member

Fixed with #1417.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants