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

Omnisharp is crashing for a .NET 5.0 project #4397

Closed
Chocanto opened this issue Feb 16, 2021 · 2 comments
Closed

Omnisharp is crashing for a .NET 5.0 project #4397

Chocanto opened this issue Feb 16, 2021 · 2 comments

Comments

@Chocanto
Copy link

Issue Description

The current version of OmniSharp is crashing for a .NET 5.0 project when trying to autocomplete.
Reinstall of the extension as been tested. Using "omnisharp.path": "latest" bring the same error.

Here is the exception in english (exception in omnisharp logs is in french) :

System.InvalidCastException: Unable to cast object of type [A]System.Threading.Tasks.Task`1[System.ValueTuple`2[Microsoft.CodeAnalysis.Completion.CompletionList,System.Boolean]] to type [B]System.Threading.Tasks.Task`1[System.ValueTuple`2[Microsoft.CodeAnalysis.Completion.CompletionList,System.Boolean]]. Type A originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\\\\Windows\\\\Microsoft.Net\\\\assembly\\\\GAC_64\\\\mscorlib\\\\v4.0_4.0.0.0__b77a5c561934e089\\\\mscorlib.dll'. Type B originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\\\\Windows\\\\Microsoft.Net\\\\assembly\\\\GAC_64\\\\mscorlib\\\\v4.0_4.0.0.0__b77a5c561934e089\\\\mscorlib.dll'.

This exception is thrown for all /complete requests.

Steps to Reproduce

Create a new .NET 5.0 project and try to autocomplete usnig TAB.

Expected Behavior

Autocomplete should work.

Actual Behavior

Omnisharp crash and autocomplete does not fully work.

Logs

OmniSharp log

[warn]: OmniSharp.Stdio.Host ************ Request ************ { "Type": "request", "Seq": 1917, "Command": "/completion", "Arguments": { "FileName": "c:\\src\\platform\\src\\JW.Platform.ImportCloudfrontRangesToVaultJob\\Job.cs", "Line": 30, "Column": 13, "CompletionTrigger": 1 } } [fail]: OmniSharp.Stdio.Host ************ Response ************ { "Request_seq": 1917, "Command": "/completion", "Running": true, "Success": false, "Message": "\"System.InvalidCastException: [A]System.Threading.Tasks.Task`1[System.ValueTuple`2[Microsoft.CodeAnalysis.Completion.CompletionList,System.Boolean]] ne peut pas être converti en [B]System.Threading.Tasks.Task`1[System.ValueTuple`2[Microsoft.CodeAnalysis.Completion.CompletionList,System.Boolean]]. Le type A provient de 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' dans le contexte 'LoadNeither' à l'emplacement 'C:\\\\Windows\\\\Microsoft.Net\\\\assembly\\\\GAC_64\\\\mscorlib\\\\v4.0_4.0.0.0__b77a5c561934e089\\\\mscorlib.dll'. Le type B provient de 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' dans le contexte 'LoadNeither' à l'emplacement 'C:\\\\Windows\\\\Microsoft.Net\\\\assembly\\\\GAC_64\\\\mscorlib\\\\v4.0_4.0.0.0__b77a5c561934e089\\\\mscorlib.dll'.\\r\\n à OmniSharp.Roslyn.CSharp.Services.Intellisense.CompletionItemExtensions.GetCompletionsInternalAsync(CompletionService completionService, Document document, Int32 caretPosition, CompletionTrigger trigger, ImmutableHashSet`1 roles, OptionSet options, CancellationToken cancellationToken) dans D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Intellisense\\\\CompletionItemExtensions.cs:ligne 65\\r\\n à OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService.d__7.MoveNext() dans D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Roslyn.CSharp\\\\Services\\\\Completion\\\\CompletionService.cs:ligne 120\\r\\n--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---\\r\\n à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n à OmniSharp.Endpoint.EndpointHandler`2.d__19.MoveNext()\\r\\n--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---\\r\\n à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n à OmniSharp.Endpoint.EndpointHandler`2.d__20.MoveNext() dans D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:ligne 230\\r\\n--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---\\r\\n à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n à OmniSharp.Endpoint.EndpointHandler`2.d__16.MoveNext() dans D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Host\\\\Endpoint\\\\EndpointHandler.cs:ligne 131\\r\\n--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---\\r\\n à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\\r\\n à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\\r\\n à OmniSharp.Stdio.Host.d__13.MoveNext() dans D:\\\\a\\\\1\\\\s\\\\src\\\\OmniSharp.Stdio\\\\Host.cs:ligne 215\"", "Body": null, "Seq": 464062, "Type": "response" }

Environment information

VSCode version: 1.53.2
C# Extension: 1.23.9

Dotnet Information SDK .NET (refl�tant tous les fichiers global.json)�: Version: 5.0.103 Commit: 72dec52dbd

Environnement d'ex�cution�:
OS Name: Windows
OS Version: 10.0.18363
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.103\

Host (useful for support):
Version: 5.0.3
Commit: c636bbdc8a

.NET SDKs installed:
3.1.100 [C:\Program Files\dotnet\sdk]
3.1.402 [C:\Program Files\dotnet\sdk]
3.1.406 [C:\Program Files\dotnet\sdk]
5.0.102 [C:\Program Files\dotnet\sdk]
5.0.103 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.24 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.1.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.2 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions
Extension Author Version
Bookmarks alefragnani 13.0.1
csharp ms-dotnettools 1.23.9
gitlens eamodio 11.2.1
ng-template Angular 11.2.0
powershell ms-vscode 2020.6.0
theme-dracula dracula-theme 2.22.3
vscode-icons vscode-icons-team 11.1.0
vscode-power-mode hoovercj 2.2.0
vsliveshare ms-vsliveshare 1.0.3629
vsliveshare-audio ms-vsliveshare 0.1.91
vsliveshare-pack ms-vsliveshare 0.4.0

Related issues :

@filipw
Copy link
Contributor

filipw commented Feb 16, 2021

this is a duplicate of #4090
Unfortunately we have not been able to reproduce this or find the root cause so far.

You can try changing your system locale to US as it only seems to happen on non-US locales.

@filipw filipw closed this as completed Feb 16, 2021
@Chocanto
Copy link
Author

@filipw I wondered the same when I saw the languages in other issues so I tried to change my system local to US but it did not change anything.

"System.InvalidCastException: [A]System.Threading.Tasks.Task`1[System.ValueTuple`2[Microsoft.CodeAnalysis.Completion.CompletionList,System.Boolean]] cannot be cast to [B]System.Threading.Tasks.Task`1[System.ValueTuple`2[Microsoft.CodeAnalysis.Completion.CompletionList,System.Boolean]]. Type A originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\\\\Windows\\\\Microsoft.Net\\\\assembly\\\\GAC_64\\\\mscorlib\\\\v4.0_4.0.0.0__b77a5c561934e089\\\\mscorlib.dll'. Type B originates from 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' in the context 'LoadNeither' at location 'C:\\\\Windows\\\\Microsoft.Net\\\\assembly\\\\GAC_64\\\\mscorlib\\\\v4.0_4.0.0.0__b77a5c561934e089\\\\mscorlib.dll'.\\r\\n

Please let me know if you want me to do some special testing ? Or if you want information from my machine !

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

No branches or pull requests

2 participants