-
Notifications
You must be signed in to change notification settings - Fork 676
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
Intellisense (omnisharp) crashes after typing. #5017
Intellisense (omnisharp) crashes after typing. #5017
Comments
Same here. Yesterday was fine, but it omnisharp crashes today. Jan/22 |
I'm glad to know it's not just me, because I was thinking it was just an issue with my PC at this point. I hope we can figure this out. |
The same problem, but it happened to me during saving any |
According to the c# extension in known issues for 1.24.0 in the changelog it says: "For Mono-based development (e.g. Unity) that requires full .NET framework, you need to set "omnisharp.useGlobalMono": "always". The current value of "auto" will remain "never" until Mono upgrades their bundled MSBuild version." You could try that. Seemed to work for me. Edit |
Thanks for the info. Sucks that it's still not working :/ I'm moving over to Visual Studio 2022 for the moment, |
Yeah, this doesn't work nor any omnisharp settings I've tried so far |
This Is happening to me too, since yesterday. i have .Net Installed and everything! |
@dreammixgames I see you have |
@JoeRobich your suggestion fixed this issue here. I've set |
@JoeRobich @synystro this suggestion didn't work for me, still periodically crashes and then won't work until I restart vscode |
Thank you! So far this has completely fixed my issue! If anyone is wondering how to do this. Go here: |
Hello. I'm running NixOS and using the omnisharp that ships with the extension is not possible. I must use the Can anyone please help me understand why clearing |
@dustinlacewell Specifically it is not having |
This looks like it could be related to a recent PR to enable running Roslyn analyzers on multiple threads. To help narrow this down, can you try with the "omnisharp.enableRoslynAnalyzers": false Or conversely, if you don't have analyzers enabled, try with the above setting set to |
I repro this on latest. It seems to be a regression in the version of An alternative workaround, besides opting out of preview builds, is to turn on Roslyn Analyzer support in {
"RoslynExtensionsOptions": {
"enableAnalyzersSupport": true
}
} This activates an implementation that does not seem to have this issue. |
An additional finding: If I switch to using .NET 6 instead of Mono, the issue doesn't reproduce for me. I.e. in VS Code settings: "omnisharp.useModernNet": true, So issue seems specific to either the Mono build or the Mono runtime somehow. |
I tried digging in the code, but it's really hard to know what's going on without being able to debug. But according to the stack trace, this line is what is blowing up: The only thing on that line that can be null is I have no idea how that could possibly be |
It could be a thread safety issue, And it's modified concurrently without a lock here: Could that possibly result in items in the list that are |
I managed to reproduce the issue and implemented a fix, works on my machine. |
@DavidZidar It sounds entirely plausible that you might end up with |
@DaRosenberg I can only concur. |
I posted this in the Visual Studio Code issues and they told me to post it here saying that it's the C# extension's issue. I basically try to use Intellisense and it crashes. I can use it for 1 second and then it crashes every time, giving me this error: "Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object." This error happens in every project & every script. I have already done an uninstall and reinstall. I have also tried different versions of Visual Studio Code. I have also tried 3 different versions of the C# extension.
I have also used the most recent version, and neither work (currently reverted to 1.23 to see if that fixed it, but nope).
This is my entire error log:
Starting OmniSharp server at 1/21/2022, 4:57:14 PM
Target: c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker\Legend Maker.sln
OmniSharp server started.
Path: c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44\OmniSharp.exe
PID: 9444
Starting OmniSharp on Windows 6.2.9200.0 (x64)
info: OmniSharp.Services.DotNetCliService
Checking the 'DOTNET_ROOT' environment variable to find a .NET SDK
info: OmniSharp.Services.DotNetCliService
Using the 'dotnet' on the PATH.
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 17.0.0 - "c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44.msbuild\Current\Bin\MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 17.0.0 - "c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44.msbuild\Current\Bin"
CscToolExe = csc.exe
CscToolPath = c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44.msbuild\Current\Bin\Roslyn
MSBuildExtensionsPath = c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44.msbuild
MSBuildToolsPath = c:\Users\nicep.vscode\extensions\ms-dotnettools.csharp-1.23.17.omnisharp\1.38.1-beta.44.msbuild\Current\Bin
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker'.
info: OmniSharp.Cake.CakeProjectSystem
Did not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
Detecting projects in 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker\Legend Maker.sln'.
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker\Assembly-CSharp.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker'.
info: OmniSharp.Script.ScriptProjectSystem
Did not find any CSX files
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker' on host 15756.
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker\Assembly-CSharp.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker\Assembly-CSharp.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\nicep\Documents\Game Projects\Legend-Maker\Legend Maker\Assembly-CSharp.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: Assembly-CSharp
Received response for /quickinfo but could not find request.
Received response for /v2/getcodeactions but could not find request.
Received response for /v2/blockstructure but could not find request.
Received response for /v2/getcodeactions but could not find request.
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at OmniSharp.Helpers.DiagnosticExtensions.<>c.b__2_0(DocumentDiagnostics x) in D:\a\1\s\src\OmniSharp.Roslyn.CSharp\Helpers\DiagnosticExtensions.cs:line 38
at System.Linq.Enumerable.d__23
3.MoveNext() at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext()at System.Linq.Lookup
2.Create[TSource](IEnumerable
1 source, Func2 keySelector, Func
2 elementSelector, IEqualityComparer1 comparer) at System.Linq.GroupedEnumerable
3.GetEnumerator()at System.Linq.Enumerable.WhereSelectEnumerableIterator
2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator
1.MoveNext()at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal(Object value, Type type, JsonSerializer jsonSerializer)
at OmniSharp.Protocol.Packet.ToString() in D:\a\1\s\src\OmniSharp.Host\Protocol\Packet.cs:line 22
at System.IO.TextWriter.WriteLine(Object value)
at System.IO.TextWriter.SyncTextWriter.WriteLine(Object value)
at OmniSharp.Services.SharedTextWriter.ProcessWriteQueue() in D:\a\1\s\src\OmniSharp.Host\Services\SharedTextWriter.cs:line 48
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The text was updated successfully, but these errors were encountered: