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

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

Closed
falquan opened this issue Oct 18, 2017 · 84 comments
Closed

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

falquan opened this issue Oct 18, 2017 · 84 comments

Comments

@falquan
Copy link

falquan commented Oct 18, 2017

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

  • Open a solution folder in VSCode
  • Navigate to a test in the project
  • Choose to Debug Test
  • Allow test to execute to finish (F5)
  • Attempt to debug or run test again OR attempt to trigger Intellisense

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
Copy link
Member

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
Copy link

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

@DustinCampbell
Copy link
Member

Excellent! Thanks for letting us know.

@DustinCampbell DustinCampbell added this to the 1.13 milestone Nov 5, 2017
@falquan
Copy link
Author

falquan commented Nov 6, 2017

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

@DustinCampbell
Copy link
Member

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

@DustinCampbell DustinCampbell removed this from the 1.13 milestone Nov 7, 2017
@vvdimov
Copy link

vvdimov commented Feb 2, 2018

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:

  • Navigate to a test in project
  • Add throw new System.Exception("message");
  • Click debug test through intellisense

Expected behavior

  • Same as orginal issue

Actual behavior

  • First run (debug test) completes and exception is thrown as expected.
    [dbug]: OmniSharp.DotNetTest.VSTestManager read:
{
    "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": []
                    }
                ]
            }
        ]
    }
}
  • Second run (debug test) triggers message in output: Debugging method 'NamespaceClassNameTestName'. No output in OmniSharp Log output window.

@Ghostbird
Copy link

Ghostbird commented Feb 15, 2018

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
Copy link
Member

@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
Copy link
Contributor

@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
Copy link
Member

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

@gregg-miskelly
Copy link
Contributor

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
Copy link
Member

  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
Copy link

Ghostbird commented Feb 27, 2018

@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
Copy link
Contributor

@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
Copy link

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
Copy link

bzier commented Jun 11, 2018

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
Copy link

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
Copy link

seanamosw commented Aug 11, 2018

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
Copy link

RoarkeRandall commented Aug 11, 2018 via email

@jmathew
Copy link

jmathew commented Aug 29, 2018

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
Copy link

craig-tive commented Sep 6, 2018

👍 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
Copy link

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

@RoarkeRandall
Copy link

RoarkeRandall commented Sep 19, 2018 via email

@rchande
Copy link

rchande commented Sep 19, 2018

@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!

@vintzl
Copy link

vintzl commented Mar 17, 2021

Is there any news to fix this omnishit bug?
Killed "${mono_cmd}" "${omnisharp_cmd}"

@WellspringCS
Copy link

@vintzl unless you're a paying customer... maybe tone it down?

@galvesribeiro
Copy link
Member

@vintzl we all know the "problems" we have with Omnisharp here and are frustrated with the lack of support but, that doesn't give you the right to come here and not be polite with others.

I would suggest you to have a look on the GitHub's and specifically this project Code of Conduct and stop this sort of comments, please.

@vintzl
Copy link

vintzl commented Mar 18, 2021

I am a "Libre User Worker". So I use as much as I can Libre and Open source software, and I have contributed in more than 10 projects (bug, codes, doc, etc…).

Microsoft is bigger than any of these enterprises, or volunteers, behind any of these projects in which I contributed, and yet some of them provide support, but here, with Microsoft, there is no support…

You want to use an IDE with a decent support for the C# stack? Well, you have to use Visual Studio on Windows. But wait, Windows 10 is, in itself, a bloatware that spies while annoying you with ads, even if you paid the license…

Not to mention Visual Studio for Mac that is as buggy as MonoDevelop… As to MonoDevelop on Linux, it is almost unusable because of the debugger issue…

And of course, Microsoft do not propose Visual Studio outside Windows (certainly, they develop it deeply coupled with Windows)… I would have bought if only it was available on Linux, but no…

But why and how I get stuck in such wired situation? Well because Microsoft said that you can develop .NET Core and C# apps with Vscode on Linux and Mac… They write this on their website and docs, tell this in a lot of their conferences. But they lied.

But I trusted them, and I start to develop not so big projects (~150 000 lines of code) with Vscode and Omnisharp.

At first, Omnisharp was pretty stable. And I remember when the review of the extension were very positive and the mark was around 4.8/5.

But slowly, I find more and more troubles to develop with Omnisharp, because it became evermore buggy. Welcome OmniBUGs.

At the same time, the mark went slowly from 4.8, to 4.5, to 4, and now 3.5/5 with 10.5M reviews… It sucks for something developed by Microsoft. Even the Python extension developed by Microsoft seems better with a mark of 4.5 for 32.8M reviews.

Insane, Microsoft do a better work with an extension for a dynamic language (that are know to be more difficult) than their own language and stack (Blazor support is very sketchy)…

Even worse, some of the bugs are very old, and prevent you to use Omnisharp.

And now? I have to restart, randomly, Omnisharp, or quit Vscode and reopen it to bring back Omnisharp and the debugger. How many times per day? Well around 20 times…

It takes at every turn minutes to load all my projects. And I remember each time what Microsoft write and say : "You can develop with Linux", "Cross-platform software".

Microsoft lied, and put a lot of Omnisharp users in Vscode in troubles. Bugs are not fixed, there is no support, no real alternative and I should not say anything? Well I disagree with this. Sorry, but this Omnisharp is a shame. it shouldn't even be marked as stable.

@MarkLeMerise
Copy link

@vintzl @armitagemderivitec

Generally, I try to stay out of conflict in Github (and the Internet in general), but I feel I need to say something. I, along with many others, get notifications for this particular issue. I am interested in knowing when it's resolved, but these types of comments that you are making are not in service of that goal.

It sounds like you both have strong opinions about the state of .NET development with macOS. Having and expressing opinions is fine. However, this thread (and rarely Github issues in general) is not the appropriate place for that. I would recommend Twitter, Reddit, blogging, etc. for a long-form discussion of your particular grievances.

Furthermore, please consider the feelings of the many maintainers who contribute to this project and many others you probably use. For example, I would never consider walking into a React thread and saying, "Yeah, this library is unusable. I use Vue; it's incredible." That simply shows a disregard for the thankless effort many people put into this software which we often pay $0/year for.

@tverboon
Copy link

#1794 (comment)

I proposed adding some extra logging. @JoeRobich do you think this would give more information?

In general I don't get bitten by this, because I stop debugging before finishing the test run. I trained myself to work around this issue this way. Hopefully this little trick helps for others as well.

@turowicz
Copy link

This is literally the only issue I have with using C# in VS Code. If you guys manage to fix this then I will not have to reload it every 5 minutes. You will save my life :)

@turowicz
Copy link

[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/getcodeactions but could not find request.
/root/.vscode-server/extensions/ms-dotnettools.csharp-1.23.9/.omnisharp/1.37.6/run: line 28: 65649 Killed                  "${mono_cmd}" "${omnisharp_cmd}" "$@"

@BDisp
Copy link

BDisp commented May 22, 2021

I also having the same issue with a single failure test.

omnisharp-killed

Edit:
When the error is triggered and I stop the continuation of the code execution, Omnisharp server still running. However, if I choose to continue running the code, despite the error, is that Omnisharp server stops working.

@msigut
Copy link

msigut commented Oct 8, 2021

Still same problem, VS Code at Apple M1, for years ... Hey developers, please help to us :)

@lonix1
Copy link

lonix1 commented Oct 8, 2021

ubuntu 20, vscode 1.60, dotnet 5.

As I posted on a related issue:

I can often (but not always) prevent a crash by disabling the "All Exceptions" and "User-Unhandled Exceptions" breakpoints. When those are disabled, it crashes less often.

When those are enabled - and I hit a breakpoint, or step through code - and step over a throw new FooException(), it'll proceed to the end of the test, then crash (a Mono crash like described above.)

@pm4rcin
Copy link
Contributor

pm4rcin commented Oct 20, 2021

I ctrl+F searched but didn't see this mentioned, but there is a way to debug from the CLI and still use VS Code while this is being fixed. Setup a debug configuration in your launch.json:

{
    "name": ".NET Core Attach",
    "type": "coreclr",
    "request": "attach",
    "processId": "${command:pickProcess}"
}

And then from the CLI:

export VSTEST_HOST_DEBUG=1
dotnet test --filter Name~myTest

Start the ".NET Core Attach" debugger in VS Code and pick the process number listed in the output from the dotnet test ... command.

And I do understand the whole point of the "click to debug" is that you don't need this rigamarole, but it helped me enhance my dotnet CLI-fu and not have to reload the VS Code window every time. (Run export VS_HOST_DEBUG=0 to turn this off).

I have found an easier way to write the command once. Basically you create a task and it waits until you attach debugger. Check this excellent article. However I think that it could be automated even more so that you only have to run task and debugger will be attached. I'll try to tinker a bit and eventually let you know since that bug is probably going to stay for a few more years.

@lonix1
Copy link

lonix1 commented Oct 20, 2021

that bug is probably going to stay for a few more years

That's really depressing 😭.

Debugging C# is a nightmare, and has been for years.

Most devs spend a double-digit percentage of their time in the debugger.

Please prioritise these debugging-related bugs. Can someone from the team please update us? 🙏

@lonix1
Copy link

lonix1 commented Nov 17, 2021

I've lost track of all the related issues so unsure where to post anymore. I'm choosing this one as it has the most activity.

I can now get fairly consistent crash logs - I know what to look for. I still don't know why or how they occur.

[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: /home/user/Workspace/test/Project.Tests/SomeClass.Tests.cs, Line: 119, Column: 11.
/home/user/.vscode/extensions/ms-dotnettools.csharp-1.23.16/.omnisharp/1.37.16/run: line 28: 448348 Killed                  "${mono_cmd}" "${omnisharp_cmd}" "$@"

Sometimes this happens even when the test passes - if I let it run it'll crash anyway. So I'm no longer certain it's a test error that causes this. It looks like a mismatch between the debugger and the source (the line mentioned in the log is blank).

I hope that log is helpful. If anyone else notices this pattern, or other patterns, please post here so we can assist in tracking down this problem.

@msigut
Copy link

msigut commented Nov 19, 2021

I've lost track of all the related issues so unsure where to post anymore. I'm choosing this one as it has the most activity.

I can now get fairly consistent crash logs - I know what to look for. I still don't know why or how they occur.

[warn]: OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService
        No symbol found. File: /home/user/Workspace/test/Project.Tests/SomeClass.Tests.cs, Line: 119, Column: 11.
/home/user/.vscode/extensions/ms-dotnettools.csharp-1.23.16/.omnisharp/1.37.16/run: line 28: 448348 Killed                  "${mono_cmd}" "${omnisharp_cmd}" "$@"

Sometimes this happens even when the test passes - if I let it run it'll crash anyway. So I'm no longer certain it's a test error that causes this. It looks like a mismatch between the debugger and the source (the line mentioned in the log is blank).

I hope that log is helpful. If anyone else notices this pattern, or other patterns, please post here so we can assist in tracking down this problem.

I've one unit test which crash every time.
So, please what log, source-code or screenshot what-ever helps you?

@lonix1
Copy link

lonix1 commented Nov 19, 2021

@msigut If you have one test that consistently crashes then you are luckier than the rest of us, because this bug is hard to reproduce. Check whether the crash is always for the same reason. If so consider posting your crash log here so the devs can look at it?

@msigut
Copy link

msigut commented Dec 9, 2021

Helps this? ....

    ************  Response (4074.3004ms) ************ 

{
"Request_seq": 2455,
"Command": "/v2/debugtest/getstartinfo",
"Running": true,
"Success": false,
"Message": ""System.InvalidOperationException: Debug session already started.\n at OmniSharp.DotNetTest.DebugSessionManager.VerifySession (System.Boolean isStarted) [0x00055] in <8a7cc1ca3e5643c3985caacb4d6f7c91>:0 \n at OmniSharp.DotNetTest.DebugSessionManager.StartSession (OmniSharp.DotNetTest.TestManager testManager) [0x00011] in <8a7cc1ca3e5643c3985caacb4d6f7c91>:0 \n at OmniSharp.DotNetTest.Services.DebugTestService.Handle (OmniSharp.DotNetTest.Models.DebugTestGetStartInfoRequest request) [0x0001b] in <8a7cc1ca3e5643c3985caacb4d6f7c91>:0 \n at OmniSharp.Endpoint.Exports.RequestHandlerExportHandler2[TRequest,TResponse].Handle (TRequest request) [0x00000] in <a6d9302e764e4effb37616da1e1cf57b>:0 \\n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].GetFirstNotEmptyResponseFromHandlers (OmniSharp.Endpoint.Exports.ExportHandler2[TRequest,TResponse][] handlers, TRequest request) [0x00022] in <a6d9302e764e4effb37616da1e1cf57b>:0 \\n at OmniSharp.Endpoint.EndpointHandler2[TRequest,TResponse].HandleRequestForLanguage (System.String language, TRequest request, OmniSharp.Protocol.RequestPacket packet) [0x00163] in :0 \n at OmniSharp.Endpoint.EndpointHandler`2[TRequest,TResponse].Process (OmniSharp.Protocol.RequestPacket packet, OmniSharp.Endpoint.LanguageModel model, Newtonsoft.Json.Linq.JToken requestObject) [0x0024b] in :0 \n at OmniSharp.Stdio.Host.HandleRequest (System.String json, Microsoft.Extensions.Logging.ILogger logger) [0x000f3] in <10866df823814b5cb7f191db9333c603>:0 "",
"Body": null,
"Seq": 3864,
"Type": "response"
}

@jacobweberbowery
Copy link

jacobweberbowery commented Feb 2, 2022

Here's an example that always crashes for me. I'm on Mac OS 12.2, on an M1 Mac, with vscode 1.63.2, dotnet 3.1.416 for x86_64 installed from here, and Mono 6.12.0.122.

I open Sample.zip in vscode, and run dotnet build Sample.Tests. At this point Intellisense works, and there's an omnisharp process running.

Then I open SampleTests.cs, click Debug All Tests, and press continue when it pauses on the exception. After it's done, Intellisense stops working, and omnisharp is no longer running.

@lonix1
Copy link

lonix1 commented Mar 14, 2022

Some feedback: since upgrading to the net6-based o#, I no longer have debugging crashes. 😄

@tverboon
Copy link

It's much faster and the debugging crashes are gone! 👍

@basvandriel
Copy link

Still experiencing the issue on OmniSharp v1.24.3. Running WSL2.

@basvandriel
Copy link

#4021 related

@two-bridges
Copy link

two-bridges commented Nov 10, 2022

When the error is triggered and I stop the continuation of the code execution, Omnisharp server still running. However, if I choose to continue running the code, despite the error, is that Omnisharp server stops working

This useful comment by @BDisp led to this successful workaround...

Kill the current process in the teardown and omnisharp no longer crashes.

This seems to have solved my problem without any side effects

        [TearDown]
        public override void AfterTest()
        {
            base.AfterTest();
            Process.GetCurrentProcess().Kill();
        }

@JoeRobich
Copy link
Member

There have been lots of improvements since this issue was opened. Please open a new issue with logs if you are still running into this.

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