dotnet / vscode-csharp

Official C# support for Visual Studio Code
MIT License
2.85k stars 670 forks source link

After single test debug, Omnisharp "crashes" silently #1794

Closed falquan closed 4 weeks ago

falquan commented 6 years ago

Environment data

dotnet --info output:

.NET Command Line Tools (2.0.0)

Product Information:
 Version:            2.0.0
 Commit SHA-1 hash:  cdcd1928c9

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.0.0/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0
  Build    : e8b8861ac7faf042c87a5c2f9f2d04c98b69f28d

VS Code version: 1.17.2 b813d12980308015bcd2b3a2f6efa5c810c33ba5 C# Extension version: 1.12.1 Xunit: 2.2.0

Steps to reproduce

Expected behavior

After test has run, OmniSharp is able to run and debug tests, and provides Intellisense from open project windows.

Actual behavior

After test has run, OmniSharp will no longer be able to run or debug a test, nor provide intellisense until restart of VSCode.

The following is the output in the OmniSharp Debug Log after turning on logging with "omnisharp.loggingLevel": "debug" (note that classnames and file paths were find/replaced, and base 64 removed -- can provide if needed):

[dbug]: OmniSharp.DotNetTest.VSTestManager
        read: {"MessageType":"TestExecution.StatsChange","Payload":{"NewTestResults":[{"TestCase":{"Properties":[{"Key":{"Id":"TestCase.FullyQualifiedName","Label":"FullyQualifiedName","Category":"","Description":"","Attributes":1,"ValueType":"System.String"},"Value":"MyClass.MyTestMethod (cef3ff6adf55e367891e1369e8ce731ad73a47a7)"},{"Key":{"Id":"TestCase.ExecutorUri","Label":"Executor Uri","Category":"","Description":"","Attributes":1,"ValueType":"System.Uri"},"Value":"executor://xunit/VsTestRunner2"},{"Key":{"Id":"TestCase.Source","Label":"Source","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"/Users/greg/Code/MySolution/test/MyTestProject/bin/Debug/netcoreapp2.0/MyTestProject.dll"},{"Key":{"Id":"TestCase.CodeFilePath","Label":"File Path","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"/Users/greg/Code/MySolution/test/MyTestProject/EndpointTests.cs"},{"Key":{"Id":"TestCase.DisplayName","Label":"Name","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"MyClass.MyTestMethod"},{"Key":{"Id":"TestCase.Id","Label":"Id","Category":"","Description":"","Attributes":1,"ValueType":"System.Guid"},"Value":"ab9c8bad-66f9-eb4d-a7e1-7dde43a5d7cf"},{"Key":{"Id":"TestCase.LineNumber","Label":"Line Number","Category":"","Description":"","Attributes":1,"ValueType":"System.Int32"},"Value":91},{"Key":{"Id":"XunitTestCase","Label":"xUnit.net Test Case","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"Xunit.Sdk.XunitTestCase, xunit.execution.{Platform}:`/* SNIP Base64 */`"},{"Key":{"Id":"TestObject.Traits","Label":"Traits","Category":"","Description":"","Attributes":5,"ValueType":"System.Collections.Generic.KeyValuePair`2[[System.String],[System.String]][]"},"Value":[{"Key":"Type","Value":"Not-Unit"},{"Key":"Type","Value":"EndToEnd"},{"Key":"Type","Value":"Not-Integration"},{"Key":"Type","Value":"Not-Performance"},{"Key":"Category","Value":"Purpose-Not-Unit"},{"Key":"Category","Value":"Purpose-EndToEnd"},{"Key":"Category","Value":"Purpose-Not-Integration"},{"Key":"Category","Value":"Purpose-Not-Performance"}]}]},"Attachments":[],"Messages":[],"Properties":[{"Key":{"Id":"TestResult.Outcome","Label":"Outcome","Category":"","Description":"","Attributes":0,"ValueType":"Microsoft.VisualStudio.TestPlatform.ObjectModel.TestOutcome, Microsoft.VisualStudio.TestPlatform.ObjectModel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"},"Value":2},{"Key":{"Id":"TestResult.ErrorMessage","Label":"Error Message","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"Assert.Equal() Failure\nExpected: Accepted\nActual:   BadRequest"},{"Key":{"Id":"TestResult.ErrorStackTrace","Label":"Error Stack Trace","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"   at MyClass.<MyTestMethod>d__6.MoveNext() in /Users/greg/Code/MySolution/test/MyTestProject/EndpointTests.cs:line 96\n--- End of stack trace from previous location where exception was thrown ---\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()"},{"Key":{"Id":"TestResult.DisplayName","Label":"TestResult Display Name","Category":"","Description":"","Attributes":1,"ValueType":"System.String"},"Value":"MyClass.MyTestMethod"},{"Key":{"Id":"TestResult.ComputerName","Label":"Computer Name","Category":"","Description":"","Attributes":0,"ValueType":"System.String"},"Value":"am-mbp-016"},{"Key":{"Id":"TestResult.Duration","Label":"Duration","Category":"","Description":"","Attributes":0,"ValueType":"System.TimeSpan"},"Value":"00:00:12.2100000"},{"Key":{"Id":"TestResult.StartTime","Label":"Start Time","Category":"","Description":"","Attributes":0,"ValueType":"System.DateTimeOffset"},"Value":"2017-10-18T14:51:01.246646-07:00"},{"Key":{"Id":"TestResult.EndTime","Label":"End Time","Category":"","Description":"","Attributes":0,"ValueType":"System.DateTimeOffset"},"Value":"2017-10-18T14:51:01.246651-07:00"}]}],"TestRunStatistics":{"ExecutedTests":1,"Stats":{"Failed":1}},"ActiveTests":[]}}
/Users/greg/.vscode/extensions/ms-vscode.csharp-1.12.1/.omnisharp/run: line 44: 16109 Killed: 9               "${MONO_CMD}" --assembly-loader=strict --config "${CONFIG}" "${OMNISHARP}" "$@"
DustinCampbell commented 6 years ago

Hi! My apologies for taking so long to reply. Could you provide your full OmniSharp Log when this happens? Also, does this happen with any test that you execute? Finally, could you try the latest beta release of C# for VS Code? You can follow the instructions here to install the latest.

tphillips commented 6 years ago

I can confirm that csharp-1.13.0-beta4.vsix resolves this issue.

DustinCampbell commented 6 years ago

Excellent! Thanks for letting us know.

falquan commented 6 years ago

Sorry for the delay on my part as well. Thanks @tphillips, I'll give that a try.

DustinCampbell commented 6 years ago

@falquan : Sounds good. Let me know me know if it still repros. I just pushed 1.13-beta5.

vvdimov commented 6 years ago

I am experiencing the same issue.

Environment


Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54

VSCode: 1.19.3 C# Extension: 1.13.1

Steps to reproduce:

Expected behavior

Actual behavior

{
    "MessageType": "TestExecution.StatsChange",
    "Payload": {
        "NewTestResults": [],
        "TestRunStatistics": {
            "ExecutedTests": 0,
            "Stats": {}
        },
        "ActiveTests": [
            {
                "Properties": [
                    {
                        "Key": {
                            "Id": "TestCase.FullyQualifiedName",
                            "Label": "FullyQualifiedName",
                            "Category": "",
                            "Description": "",
                            "Attributes": 1,
                            "ValueType": "System.String"
                        },
                        "Value": "TestName"
                    },
                    {
                        "Key": {
                            "Id": "TestCase.ExecutorUri",
                            "Label": "Executor Uri",
                            "Category": "",
                            "Description": "",
                            "Attributes": 1,
                            "ValueType": "System.Uri"
                        },
                        "Value": "executor://MSTestAdapter/v2"
                    },
                    {
                        "Key": {
                            "Id": "TestCase.Source",
                            "Label": "Source",
                            "Category": "",
                            "Description": "",
                            "Attributes": 0,
                            "ValueType": "System.String"
                        },
                        "Value": "/FullPathToDLL.dll"
                    },
                    {
                        "Key": {
                            "Id": "TestCase.CodeFilePath",
                            "Label": "File Path",
                            "Category": "",
                            "Description": "",
                            "Attributes": 0,
                            "ValueType": "System.String"
                        },
                        "Value": "/FullPathToCSFile.cs"
                    },
                    {
                        "Key": {
                            "Id": "TestCase.DisplayName",
                            "Label": "Name",
                            "Category": "",
                            "Description": "",
                            "Attributes": 0,
                            "ValueType": "System.String"
                        },
                        "Value": "TestName"
                    },
                    {
                        "Key": {
                            "Id": "TestCase.Id",
                            "Label": "Id",
                            "Category": "",
                            "Description": "",
                            "Attributes": 1,
                            "ValueType": "System.Guid"
                        },
                        "Value": "adab9476-82ab-17ad-4bf9-fd4904a82d41"
                    },
                    {
                        "Key": {
                            "Id": "TestCase.LineNumber",
                            "Label": "Line Number",
                            "Category": "",
                            "Description": "",
                            "Attributes": 1,
                            "ValueType": "System.Int32"
                        },
                        "Value": 50
                    },
                    {
                        "Key": {
                            "Id": "MSTestDiscoverer.TestClassName",
                            "Label": "ClassName",
                            "Category": "",
                            "Description": "",
                            "Attributes": 1,
                            "ValueType": "System.String"
                        },
                        "Value": "FullClassName"
                    },
                    {
                        "Key": {
                            "Id": "TestObject.Traits",
                            "Label": "Traits",
                            "Category": "",
                            "Description": "",
                            "Attributes": 5,
                            "ValueType": "System.Collections.Generic.KeyValuePair`2[[System.String],[System.String]][]"
                        },
                        "Value": []
                    }
                ]
            }
        ]
    }
}
Ghostbird commented 6 years ago

Is there a workaround available for this? I think this issue is causing me problems too. I run an xUnit test from the "debug test" text that appears above the test method. Then after I've finished debugging that test, the "debug test" button no longer appears. I have to restart VSCode to debug the test again.

Note: Restarting Omnisharp through Ctr+Shift+P > Omnisharp: Restart Omnisharp does not bring the button back.

The Omnisharp log reads:

OmniSharp server started wth Mono
    Path: ~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/run
    PID: 14761

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on debian 9.0 (x64)
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = ~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild
            CscToolPath = ~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = ~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks

Lots of lines that seemed irrelevant snipped

[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session started.
~/.vscode/extensions/ms-vscode.csharp-1.13.1/.omnisharp/run: line 44: 14767 Killed                  "${MONO_CMD}" --assembly-loader=strict --config "${CONFIG}" "${OMNISHARP}" "$@"

EDIT: Just updated the plugin to version 1.14.0, but the problem persists. EDIT: It seems specific to a case like this:

Assert.True(x().y);

And then only when an exception is thrown in x(). When x() returns null and the . operator throws an exception, omnisharp does not crash.

DustinCampbell commented 6 years ago

@gregg-miskelly: Does @Ghostbird's last edit give you ideas? If it really is related to when exceptions happen at runtime, maybe this is a debugger issue?

gregg-miskelly commented 6 years ago

@DustinCampbell do you have any idea what run: line 44: might be in reference to?

@Ghostbird Two questions --

  1. If you look at a process listing while the test is running, can you see what process matches up with the 14767 Killed part of the statement?
  2. If you throw the exception from x() does the debugger stop on that exception? Or does the test worker process catch the exception and then shutdown? (Or maybe go on to run another test)
DustinCampbell commented 6 years ago

@gregg-miskelly: run is the launch script for OmniSharp. line 44 is the last line of the script.

gregg-miskelly commented 6 years ago

Ah. In that case @Ghostbird you can ignore my first question, though the second question would still be interesting.

Dustin, a few more questions --

  1. Will OmniSharp normally print something useful when it crashes (ex: exception type, message or stack trace), and therefore this means that this crash is a more fatal error where the mono runtime falls over (ex: out-of-memory, stack overflow, or internal error in the runtime itself)? Or does mono just normally not print much?
  2. Does the XUnit runner get loaded into the OmniSharp process? Or is there a process boundary there?
  3. Does the XUnit running return results back to OmniSharp after every test runs?
DustinCampbell commented 6 years ago
  1. Yes -- it should -- especially if the omnisharp.loggingLevel is set to debug.
  2. No. It launches dotnet vstest, which runs the xunit test adapter.
  3. No.
Ghostbird commented 6 years ago

@gregg-miskelly On question two. The debugger correctly stops on the exception but once I continue, after having debugged my part, Omnisharp crashes.

gregg-miskelly commented 6 years ago

@DustinCampbell is there an easy way for Ghostbird to attach a mono debugger to OmniSharp to see if this reveals something more useful?

@Ghostbird can you check whatever system logs you have to see if there is any information on what is killing Omnisharp or why? If you aren't sure how to do this, I can do some looking around if you tell me what OS you are on.

RoarkeRandall commented 6 years ago

Same issue here. It's a show stopper for me I think. Nothing stands out in omni-sharp logs. I see the test complete, and then all omnisharp functionality is halted. If I restart omnisharp, the status at the bottom will be a flame and say "Running", usually it will have a flame and the solution file name. Only way to get it running again is to quite vscode.

.NET Command Line Tools (2.1.4)

Product Information:
 Version:            2.1.4
 Commit SHA-1 hash:  5e8add2190

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.4/

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.5
  Build    : 17373eb129b3b05aa18ece963f8795d65ef8ea54
bzier commented 6 years ago

Same issue for me as well. As mentioned above, just restarting OmniSharp does not help, but it seems that CTRL+Shift+P > Reload Window does restore functionality. A little quicker than quitting VS Code altogether and relaunching.

justin-lavelle commented 6 years ago

It seems that if the unit test has a failure, Assert.False(true) then it crashes and I have to reload the window to get it working again. CTRL+SHIFT+P > Reload Window. Or if it stop debugging before the Assert throws I can restart it.

VSCode 1.24.1 ms-vscode-csharp 1.15.2

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.300/

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.1.4 [/usr/local/share/dotnet/sdk]
  2.1.300 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
seanamosw commented 6 years ago

I'm also bumping into this. As others have said, using Restart OmniSharp from the command palette doesn't get OmniSharp working again. You have to at minimum use Reload Window to get it working again.

I tried to track down in what cases it reproduces, but it is kind of random. Sometimes you can debug multiple times in a row and it works just fine. Most of the time, a single debugging session is enough to crash it, especially if you inspect variables.

VSCode 1.25.1 ms-vscode.csharp 1.15.2

dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.302
 Commit:    9048955601

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.302/

Host (useful for support):
  Version: 2.1.2
  Commit:  811c3ce6c0

.NET Core SDKs installed:
  2.1.302 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.2 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
RoarkeRandall commented 6 years ago

My work around has been to exit the debug session (click the red box) before the unit test completes.

On Sat, Aug 11, 2018, 7:52 AM seanamosw notifications@github.com wrote:

I'm also bumping into this. As others have said, using Restart OmniSharp from the command palette doesn't get OmniSharp working again. You have to at minimum use Reload Window to get it working again.

I tried to track down in what cases it reproduces, but it is kind of random. Sometimes you can debug multiple times in a row and it works just fine. Most of the time, a single debugging session is enough to crash it, especially if you inspect variables.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-vscode/issues/1794#issuecomment-412280128, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWU7zgkMBRPlYk3GbgNzVYDX7GmDdwTks5uPu-9gaJpZM4P-bOV .

jmathew commented 6 years ago

I'm seeing the same thing. Reload window is required to bring it back.

[info]: OmniSharp.DotNetTest.DebugSessionManager
        Debug session started.
/Users/myuser/.vscode/extensions/ms-vscode.csharp-1.15.2/.omnisharp/1.30.1/run: line 50: 48897 Killed: 9               "${MONO_CMD}" "${OMNISHARP_CMD}" "$@"

Using vscode version

Version 1.26.1 (1.26.1)
craig-tive commented 6 years ago

👍 for getting this fixed. This is a major annoyance. Any additional steps I could run to help debug this?

VSCode 1.27.0 ms-vscode.csharp 1.15.2


dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   2.1.300
 Commit:    adab45bf0c

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.13
 OS Platform: Darwin
 RID:         osx.10.13-x64
 Base Path:   /usr/local/share/dotnet/sdk/2.1.300/

Host (useful for support):
  Version: 2.1.0
  Commit:  caa7b7e2ba

.NET Core SDKs installed:
  2.1.300 [/usr/local/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.1.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]```
ognjenkurtic commented 6 years ago

Issue still exists in 1.16.1. Do you need any further info\help for fixing this?

RoarkeRandall commented 6 years ago

Yes, they need an example project to repro this. If you're about to make one that would be awesome!

On Wed, Sep 19, 2018, 3:15 AM ognjenkurtic notifications@github.com wrote:

Issue still exists in 1.16.1. Do you need any further info\help for fixing this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-vscode/issues/1794#issuecomment-422742239, or mute the thread https://github.com/notifications/unsubscribe-auth/AGWU7z3pT60_3TAGzs2HF-0171ypxPcFks5uchk2gaJpZM4P-bOV .

rchande commented 6 years ago

@ognjenkurtic @RoarkeRandall I used to be able to reproduce this on 15.2, but am no longer able on 16.1. A repro project would be great!

akshita31 commented 6 years ago

Related issues: https://github.com/OmniSharp/omnisharp-vscode/issues/2106 https://github.com/OmniSharp/omnisharp-vscode/issues/2398

akshita31 commented 6 years ago

@rchande I am able to reproduce it on my Ubuntu 18.04 system after clicking the "Debug Test" 2-3 times. Here is the repro project: https://github.com/akshita31/Samples-BankTesting.

Here is my OmniSharp log:

Starting OmniSharp server at 2018-09-19, 8:50:00 PM
    Target: /home/akshita31/BankTesting/BankTesting.sln

OmniSharp server started.
    Path: /home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/run
    PID: 10092

[info]: OmniSharp.Stdio.Host
        Starting OmniSharp on ubuntu 18.4 (x64)
[info]: OmniSharp.Services.DotNetCliService
        DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Located 1 MSBuild instance(s)
            1: StandAlone 15.0 - "/home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        MSBUILD_EXE_PATH environment variable set to '/home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin/MSBuild.dll'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
        Registered MSBuild instance: StandAlone 15.0 - "/home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin"
            MSBuildExtensionsPath = /usr/lib/mono/xbuild
            BypassFrameworkInstallChecks = true
            CscToolPath = /home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin/Roslyn
            CscToolExe = csc.exe
            MSBuildToolsPath = /home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/omnisharp/msbuild/15.0/Bin
            TargetFrameworkRootPath = /usr/lib/mono/xbuild-frameworks
[info]: OmniSharp.Cake.CakeProjectSystem
        Detecting Cake files in '/home/akshita31/BankTesting'.
[info]: OmniSharp.Cake.CakeProjectSystem
        Could not find any Cake files
[info]: OmniSharp.WorkspaceInitializer
        Project system 'OmniSharp.DotNet.DotNetProjectSystem' is disabled in the configuration.
[info]: OmniSharp.MSBuild.ProjectSystem
        Detecting projects in '/home/akshita31/BankTesting/BankTesting.sln'.
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/akshita31/BankTesting/Bank/Bank.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Queue project update for '/home/akshita31/BankTesting/BankTests/BankTests.csproj'
[info]: OmniSharp.Script.ScriptProjectSystem
        Detecting CSX files in '/home/akshita31/BankTesting'.
[info]: OmniSharp.Script.ScriptProjectSystem
        Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
        Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpWorkspaceOptionsProvider
[info]: OmniSharp.WorkspaceInitializer
        Configuration finished.
[info]: OmniSharp.Stdio.Host
        Omnisharp server running using Stdio at location '/home/akshita31/BankTesting' on host 9100.
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/akshita31/BankTesting/Bank/Bank.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/akshita31/BankTesting/Bank/Bank.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/akshita31/BankTesting/Bank/Bank.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: /home/akshita31/BankTesting/BankTests/BankTests.csproj
[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file '/home/akshita31/BankTesting/BankTests/BankTests.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
        Adding project '/home/akshita31/BankTesting/BankTests/BankTests.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: Bank
[info]: OmniSharp.MSBuild.ProjectManager
        Update project: BankTests
[warn]: OmniSharp.MSBuild.ProjectManager
        Unable to resolve assembly '/home/akshita31/BankTesting/Bank/bin/Debug/netstandard2.0/Bank.dll'
[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.
/home/akshita31/.vscode/extensions/ms-vscode.csharp-1.16.1/.omnisharp/1.32.5/run: line 28: 10097 Killed                  "${mono_cmd}" "${omnisharp_cmd}" "$@"
ognjenkurtic commented 6 years ago

@akshita31 Thanks! I also experience it on Ubuntu 18.4 but not on Windows.

bzier commented 6 years ago

For what it's worth, I was experiencing the problem on Ubuntu 16.04.

galvesribeiro commented 5 years ago

Same problem happens on OSX.

tverboon commented 5 years ago

Would it be possible to add some extra logging around:

https://github.com/OmniSharp/omnisharp-roslyn/blob/6836fadb9c35a88d4695276d14302336a460b841/src/OmniSharp.DotNetTest/DebugSessionManager.cs#L99

Console logs on macOS don't give any clue. The dotnet test process exits with code 0. vscodedbg-ui, which is the parent process, doesn't log either.

It looks like this OnExit() event doesn't get called sometimes. If that's the case, this bug belongs to CoreCLR Mono maybe? Also this issue isn't reproducible on Windows, which is a bit suspicious.

Manually stopping debug process prevents this issue from happening, in that case EndSession() gets called.

rchande commented 5 years ago

@tverboon That's a good idea...

KeynesYouDigIt commented 5 years ago

Reporting same issue ubuntu 18

radu99999 commented 5 years ago

Same issue on ubuntu 18.04

galvesribeiro commented 5 years ago

Hey folks,

Its been more than an year since this issue was open and tons of updates were pushed out to both VSCode and OmniSharp extension...

Do we have any idea when this issue will be investigated and given the proper attention?

Testing is a very important part of any dev workflow, specially if you are using an editor as VSCode and having to reload the editor every time you run a test, is something not acceptable.

Thanks folks!

rchande commented 5 years ago

@galvesribeiro This is a complicated issue and we're working with the mono and MSBuild teams to investigate.

ethan-deng commented 5 years ago

Same here with Nunit. Just debug a test case with failed assertion and then debug won't work again.

ethan-deng commented 5 years ago

Just found a solution. When the test case failed with a assertion such as "Assert.AreEqual(-1,1)", when the debugger is stopped with unhandled exception, do not continue the debugger to finish but stop the debugger and it won't crashed the debugger.

Ghostbird commented 5 years ago

Just found a solution. When the test case failed with a assertion such as "Assert.AreEqual(-1,1)", when the debugger is stopped with unhandled exception, do not continue the debugger to finish but stop the debugger and it won't crashed the debugger.

That's the workaround I have been using since the time I posted this However, in retrospect, that is not clear at all from my comment. Sorry about that.

paulhannon0 commented 5 years ago

@galvesribeiro This is a complicated issue and we're working with the mono and MSBuild teams to investigate.

@rchande Any word on this? Coming up on 2 years since this was reported now.

paulhannon0 commented 5 years ago

@rchande

nGoline commented 4 years ago

I'm also having this error but in a bit different scenario. Mine only occurs when I'm testing this line: await Assert.ThrowsAsync<HttpRequestException>(async () => { await _rpcService.errorCommand(); }); As expected it throws the exception and then Omnisharp simply crashes and can only be restored by running CTRL+Shift+P > Reload Window Anyway, here is my Omnisharp log:

[info]: OmniSharp.Roslyn.CSharp.Services.Refactoring.V2.RunCodeActionService
        Applying code action: using System.Net.Http;
[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.
/home/me/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/run: line 28: 14030 Killed

Now, if I run the tests Omnisharp doesn't care about it and the test passes without a problem.

[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 3.0.1)
[xUnit.net 00:00:00.65]   Discovering: Project.Tests
[xUnit.net 00:00:00.73]   Discovered:  Project.Tests
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.1 (64-bit .NET Core 3.0.1)
[xUnit.net 00:00:00.66]   Starting:    Project.Tests
[xUnit.net 00:00:01.11]   Finished:    Project.Tests
----- Test Execution Summary -----

Project.Tests.ServiceTests.RPCService_Should.ThrowOnInvalidCommand:
    Outcome: Passed

Total tests: 1. Passed: 1. Failed: 0. Skipped: 0
paulhannon0 commented 4 years ago

@DustinCampbell @rchande @gregg-miskelly Can anybody shed any light on this? Well over 2 years old now...

gregg-miskelly commented 4 years ago

@paulhannon0 None of the people you are messaging work on this area. I will follow up with some folks though and see if I can get this issue some love.

chrispaynter commented 4 years ago

This error is happening to me regularly across multiple unrelated tests. I seem to get normal Omnisharp logging until all of a sudden I get this.

/Users/chris/.vscode/extensions/ms-vscode.csharp-1.21.9/.omnisharp/1.34.9/run: line 28: 86510 Killed: 9               "${mono_cmd}" "${omnisharp_cmd}" "$@"

VSCode then has to be restarted to get Intellisense and testing back.

WellspringCS commented 4 years ago

Here to report problem still present on Ubuntu 18.04 and (like coronavirus) it does not discriminate between noobs and experts. This noob is thankful to @ethan-deng and @Ghostbird for posting a work-around.

stewberticus commented 4 years ago

Can confirm this is still an issue

xnerdpj commented 4 years ago

I can confirm that this is still an issue, but also provide some more info.

It appears to happen (at least for me) when there are unhandled exceptions in an an async call stack.

iainb123 commented 4 years ago

I've had this problem for a while too... until I found this issue I'd assumed that this had to be something specific to my project (as otherwise there'd be loads of people complaining about it!) Glad I'm not alone. I've got used to restarting VS Code regularly, but it would be nice to have a fix. The work-around doesn't work for me unfortunately.

Sometimes I don't even get a debug session - it appears to start, then immediately dies:

`info: OmniSharp.DotNetTest.VSTestManager read: {"MessageType":"TestSession.Connected","Payload":null}

    read: {"MessageType":"ProtocolVersion","Payload":1}
    Debug session started.

~/.vscode/extensions/ms-dotnettools.csharp-1.22.0/.omnisharp/1.35.2/run: line 28: 63560 Killed: 9 "${mono_cmd}" "${omnisharp_cmd}" "$@"`

I can pretty much reproduce at will. Anything I can do to help debug?

paulhannon0 commented 4 years ago

Going on 3 years.... 🤦

RoarkeRandall commented 4 years ago

This bug is going to deserve a blog post once it's fixed.

On Thu, Jun 11, 2020 at 5:59 AM Paul Hannon notifications@github.com wrote:

Going on 3 years.... 🤦

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/OmniSharp/omnisharp-vscode/issues/1794#issuecomment-642630929, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSZJ33H7OM2HQ5JHR2GJRTRWDIKLANCNFSM4D7ZWOKQ .