Omnisharp stops a few minutes after loading project
See original GitHub issueIssue Description
Project works fine for a few minutes, then all omnisharp features stop working (intellisense and go-to reference, etc…).
Logs
OmniSharp log
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: index
at Microsoft.CodeAnalysis.Text.SourceText+LineInfo.get_Item (System.Int32 index) [0x0000f] in <ae0917f99a2140a190480a55c4fbf9ad>:0
at OmniSharp.Helpers.LocationExtensions.GetQuickFix (Microsoft.CodeAnalysis.Location location, OmniSharp.OmniSharpWorkspace workspace) [0x0007a] in <9a68c6cb5d34406fb639c5d426ef0d9e>:0
at OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService+<>c__DisplayClass2_0.<Handle>b__2 (Microsoft.CodeAnalysis.Location l) [0x00000] in <9a68c6cb5d34406fb639c5d426ef0d9e>:0
at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00048] in <6f6cfe3dc7984568b6f7767c7378b138>:0
at System.Linq.Set`1[TElement].UnionWith (System.Collections.Generic.IEnumerable`1[T] other) [0x00018] in <6f6cfe3dc7984568b6f7767c7378b138>:0
at System.Linq.Enumerable+DistinctIterator`1[TSource].FillSet () [0x0000b] in <6f6cfe3dc7984568b6f7767c7378b138>:0
at System.Linq.Enumerable+DistinctIterator`1[TSource].ToArray () [0x00000] in <6f6cfe3dc7984568b6f7767c7378b138>:0
at System.Linq.Buffer`1[TElement]..ctor (System.Collections.Generic.IEnumerable`1[T] source) [0x0000a] in <6f6cfe3dc7984568b6f7767c7378b138>:0
at System.Linq.OrderedEnumerable`1+<GetEnumerator>d__3[TElement].MoveNext () [0x0001e] in <6f6cfe3dc7984568b6f7767c7378b138>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList (Newtonsoft.Json.JsonWriter writer, System.Collections.IEnumerable values, Newtonsoft.Json.Serialization.JsonArrayContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000e1] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000d4] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0008d] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000b0] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonObjectContract contract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract collectionContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x0008d] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue (Newtonsoft.Json.JsonWriter writer, System.Object value, Newtonsoft.Json.Serialization.JsonContract valueContract, Newtonsoft.Json.Serialization.JsonProperty member, Newtonsoft.Json.Serialization.JsonContainerContract containerContract, Newtonsoft.Json.Serialization.JsonProperty containerProperty) [0x000b0] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00079] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00253] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) [0x00028] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <07e3893119a945b29a35e81930b1c8ad>:0
at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) [0x00000] in <07e3893119a945b29a35e81930b1c8ad>:0
at OmniSharp.Protocol.Packet.ToString () [0x00000] in <1ed0cdfb5a5d42889b4f5df087ff7bd6>:0
at System.IO.TextWriter.WriteLine (System.Object value) [0x00028] in <285579f54af44a2ca048dad6be20e190>:0
at System.IO.TextWriter+SyncTextWriter.WriteLine (System.Object value) [0x00000] in <285579f54af44a2ca048dad6be20e190>:0
at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(object)
at OmniSharp.Services.SharedTextWriter.ProcessWriteQueue () [0x0001d] in <1ed0cdfb5a5d42889b4f5df087ff7bd6>:0
at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <285579f54af44a2ca048dad6be20e190>:0
at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <285579f54af44a2ca048dad6be20e190>:0
Environment information
VSCode version: 1.41.1 C# Extension: 1.21.9
Mono Information
OmniSharp using global mono :6.4.0Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 3.0.101 Commit: bc5f8df0f5Runtime Environment: OS Name: linuxmint OS Version: 19 OS Platform: Linux RID: linuxmint.19-x64 Base Path: /usr/share/dotnet/sdk/3.0.101/
Host (useful for support): Version: 3.0.1 Commit: 19942e7199
.NET Core SDKs installed: 2.1.802 [/usr/share/dotnet/sdk] 2.2.402 [/usr/share/dotnet/sdk] 3.0.101 [/usr/share/dotnet/sdk]
.NET Core runtimes installed: Microsoft.AspNetCore.All 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.All 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.0.1 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 2.2.8 [/usr/share/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 3.0.1 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download
Visual Studio Code Extensions
Extension | Author | Version |
---|---|---|
Angular-BeastCode | Mikael | 8.1.2 |
angular-console | nrwl | 10.0.0 |
angular-essentials | johnpapa | 0.6.3 |
Angular2 | johnpapa | 8.3.0 |
angular2-inline | natewallace | 0.0.17 |
auto-using | Fudge | 0.7.9 |
azure-bot | Zim | 0.0.4 |
csharp | ms-vscode | 1.21.9 |
cshtml | fireside21 | 0.1.3 |
debugger-for-chrome | msjsdiag | 4.12.3 |
EditorConfig | EditorConfig | 0.14.4 |
gitlens | eamodio | 10.2.0 |
material-icon-theme | PKief | 3.9.2 |
mssql | ms-mssql | 1.8.0 |
ng-template | Angular | 0.900.3 |
prettier-standard-vscode | numso | 0.6.0 |
prettier-vscode | esbenp | 3.18.0 |
python | ms-python | 2019.11.50794 |
r | Ikuyadeu | 1.2.0 |
sqltools | mtxr | 0.21.5 |
team | ms-vsts | 1.161.0 |
tsimporter | pmneo | 2.0.1 |
vsc-prolog | arthurwang | 0.8.23 |
vscode-color | anseki | 0.4.5 |
vscode-eslint | dbaeumer | 2.0.11 |
vscode-icons | vscode-icons-team | 9.6.0 |
vscode-mysql | formulahendry | 0.4.0 |
vscode-npm-script | eg2 | 0.3.10 |
vscode-nuget-package-manager | jmrog | 1.1.6 |
vscode-peacock | johnpapa | 3.2.0 |
vscode-sqlite | alexcvzz | 0.8.1 |
vscode-typescript-tslint-plugin | ms-vscode | 1.2.3 |
winteriscoming | johnpapa | 1.3.0 |
xml | DotJoshJohnson | 2.5.0 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:9
- Comments:12 (4 by maintainers)
Top GitHub Comments
Thank, this is a good repro.
I had a quick look and the problem here is that here we fall out of bounds with the current implementation.
In this case the state is as follow:
location
isSourceLocation(c:\code\repro-omnisharp-crash\Pages\Test.cshtml__bg__virtual.cs@116:40)"Stats"
{c:\code\repro-omnisharp-crash\Pages\Test.cshtml: (143,39)-(143,44)}
So what we do wrong is that we try to fetch line with index 143 (as defined in
Test.cshtml
) out ofTest.cshtml__bg__virtual.cs
which only has 138 lines in this case. So we try to pick text from the wrong document. We should pick the path from mapped line span, locate that document in the workspace and use that to pick the text.What’s funny is that it mostly works because the lines are correct and the filepath returned too, just the text doesn’t add up; however VS Code doesn’t use the text - only lines and filepath. So this crashes only when the real CSHTML is longer than the generated file.
OmniSharp keeps crashing for me, too. After this error, IntelliSense etc. no longer works:
The line in question is not anything complex:
OmniSharp: c:\Users.….vscode\extensions\ms-dotnettools.csharp-1.23.8.omnisharp\1.37.6-beta.30\OmniSharp.exe