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

Unhandled exception in Razor file when targeting net6.0 #4573

Closed
JoeRobich opened this issue May 26, 2021 · 2 comments
Closed

Unhandled exception in Razor file when targeting net6.0 #4573

JoeRobich opened this issue May 26, 2021 · 2 comments

Comments

@JoeRobich
Copy link
Member

Issue Description

OmniSharp process is killed when trying to provide language services within a .razor file.

The same project targeting net5.0 does not have this issue. Wondering if the issue might be SourceGenerator related.

Steps to Reproduce

Create a new blazor server application by running dotnet new blazorserver -o TestBlazor
Open the TestBlazor folder in vscode by running code ./TestBlazor
Wait for OmniSharp to finish loading the project
Open Pages/Counter.razor
Click on @currentCounter and hover over it

Expected Behavior

QuickInfo is displayed and possibly CodeActions are recommended

Actual Behavior

The OmniSharp process is killed by an unhandled exception.

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at OmniSharp.Helpers.LocationExtensions+<>c__DisplayClass0_0.<GetQuickFix>b__3 (Microsoft.CodeAnalysis.Document d) [0x00000] in <7cebb9e2d32f406c90f8cf74ce960a45>:0 
  at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) [0x0003f] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00000] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at OmniSharp.Helpers.LocationExtensions.<GetQuickFix>g__GetSourceText|0_0 (Microsoft.CodeAnalysis.Location location, System.Collections.Generic.IEnumerable`1[T] documents, System.Boolean hasMappedPath) [0x00013] in <7cebb9e2d32f406c90f8cf74ce960a45>:0 
  at OmniSharp.Helpers.LocationExtensions.GetQuickFix (Microsoft.CodeAnalysis.Location location, OmniSharp.OmniSharpWorkspace workspace) [0x00056] in <7cebb9e2d32f406c90f8cf74ce960a45>:0 
  at OmniSharp.Roslyn.CSharp.Services.Navigation.FindUsagesService+<>c__DisplayClass3_0.<Handle>b__2 (Microsoft.CodeAnalysis.Location l) [0x00000] in <7cebb9e2d32f406c90f8cf74ce960a45>:0 
  at System.Linq.Enumerable+SelectEnumerableIterator`2[TSource,TResult].MoveNext () [0x00048] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at System.Linq.Set`1[TElement].UnionWith (System.Collections.Generic.IEnumerable`1[T] other) [0x00018] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at System.Linq.Enumerable+DistinctIterator`1[TSource].FillSet () [0x0000b] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at System.Linq.Enumerable+DistinctIterator`1[TSource].ToArray () [0x00000] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at System.Linq.Buffer`1[TElement]..ctor (System.Collections.Generic.IEnumerable`1[T] source) [0x0000a] in <17e8581c65f940ca8137dd67206f5dbd>:0 
  at System.Linq.OrderedEnumerable`1+<GetEnumerator>d__3[TElement].MoveNext () [0x0001e] in <17e8581c65f940ca8137dd67206f5dbd>: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 <2676a2da6edc420e890ed28aa4572ee5>: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) [0x000d6] in <2676a2da6edc420e890ed28aa4572ee5>: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 <2676a2da6edc420e890ed28aa4572ee5>: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) [0x000b2] in <2676a2da6edc420e890ed28aa4572ee5>: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 <2676a2da6edc420e890ed28aa4572ee5>: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) [0x000b2] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00079] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at Newtonsoft.Json.JsonSerializer.SerializeInternal (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x0023a] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at Newtonsoft.Json.JsonSerializer.Serialize (Newtonsoft.Json.JsonWriter jsonWriter, System.Object value, System.Type objectType) [0x00000] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObjectInternal (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializer jsonSerializer) [0x00028] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value, System.Type type, Newtonsoft.Json.JsonSerializerSettings settings) [0x00007] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at Newtonsoft.Json.JsonConvert.SerializeObject (System.Object value) [0x00000] in <2676a2da6edc420e890ed28aa4572ee5>:0 
  at OmniSharp.Protocol.Packet.ToString () [0x00000] in <32f893db32d8414b88ecbc8842ce6d2c>:0 
  at System.IO.TextWriter.WriteLine (System.Object value) [0x00028] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 
  at System.IO.TextWriter+SyncTextWriter.WriteLine (System.Object value) [0x00000] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 
  at (wrapper synchronized) System.IO.TextWriter+SyncTextWriter.WriteLine(object)
  at OmniSharp.Services.SharedTextWriter.ProcessWriteQueue () [0x0001d] in <32f893db32d8414b88ecbc8842ce6d2c>:0 
  at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) [0x00014] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) [0x0002b] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 
  at System.Threading.ThreadHelper.ThreadStart () [0x00008] in <b18e5763ec3f41e68a8fe16d7f5e0bee>:0 

Logs

OmniSharp log

Post the output from Output-->OmniSharp log here

C# log

Post the output from Output-->C# here

Environment information

VSCode version: 1.57.0-insider
C# Extension: 1.23.12

Mono Information OmniSharp using built-in mono
Dotnet Information .NET SDK (reflecting any global.json): Version: 6.0.100-preview.4.21255.9 Commit: 950e4949a7

Runtime Environment:
OS Name: Mac OS X
OS Version: 11.0
OS Platform: Darwin
RID: osx.11.0-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100-preview.4.21255.9/

Host (useful for support):
Version: 6.0.0-preview.5.21229.9
Commit: 49aec59e52

.NET SDKs installed:
2.1.811 [/usr/local/share/dotnet/sdk]
3.1.408 [/usr/local/share/dotnet/sdk]
3.1.409 [/usr/local/share/dotnet/sdk]
5.0.104 [/usr/local/share/dotnet/sdk]
5.0.202 [/usr/local/share/dotnet/sdk]
5.0.203 [/usr/local/share/dotnet/sdk]
6.0.100-alpha.1.21065.7 [/usr/local/share/dotnet/sdk]
6.0.100-preview.1.21103.13 [/usr/local/share/dotnet/sdk]
6.0.100-preview.2.21155.3 [/usr/local/share/dotnet/sdk]
6.0.100-preview.3.21202.5 [/usr/local/share/dotnet/sdk]
6.0.100-preview.4.21255.9 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.All 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.7 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.9 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.11 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.14 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.1.15 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.7.20365.19 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.8.20412.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-preview.8.20414.8 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.1.20451.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20474.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0-rc.2.20475.17 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-alpha.1.21064.29 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.1.21103.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.2.21154.6 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.3.21201.13 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.0-preview.4.21253.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.23 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.14 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.1.15 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.1.21102.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.2.21154.6 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.4.21221.4 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.4.21253.7 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.0-preview.5.21229.9 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

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

Visual Studio Code Extensions
Extension Author Version
cpptools ms-vscode 1.3.1
csharp ms-dotnettools 1.23.12
debugger-for-chrome msjsdiag 4.12.12
debugger-for-edge msjsdiag 1.0.15
dotnet-test-explorer formulahendry 0.7.5
EditorConfig EditorConfig 0.16.4
gitlens eamodio 11.4.1
jupyter ms-toolsai 2021.6.879154572
msbuild-project-tools tintoy 0.3.15
powershell-preview ms-vscode 2021.5.0
remote-containers ms-vscode-remote 0.179.0
remote-ssh ms-vscode-remote 0.65.6
remote-ssh-edit ms-vscode-remote 0.65.6
remote-wsl ms-vscode-remote 0.56.3
vscode-eslint dbaeumer 2.1.20
vscode-remote-extensionpack ms-vscode-remote 0.21.0
vscode-typescript-tslint-plugin ms-vscode 1.3.3
vsliveshare ms-vsliveshare 1.0.4272
vsliveshare-audio ms-vsliveshare 0.1.91
@filipw
Copy link
Contributor

filipw commented May 26, 2021

looks the same as OmniSharp/omnisharp-roslyn#2125?
opened OmniSharp/omnisharp-roslyn#2163 for a quick fix

@JoeRobich
Copy link
Member Author

Closing as duplicate of OmniSharp/omnisharp-roslyn#2125

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

2 participants