Closed NTaylorMullen closed 3 years ago
We ran into this issue on Mac/Linux with latest .NET 6.0 Preview 3 build and there are some fail logs as following and check "https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1284417" for more details
We ran into this issue in the latest .NET 6.0 Preview 3 build when opening the Program.cs file or reopening the project. And there are some logs as following and check here for more details.
@captainsafia @pranavkm I imagine the source generator bit failing in O# is expected?
Nope -- I haven't seen this before. The only O# related issues we're tracking at the moment occur after the source generators are loaded.
I'm not familiar with how O#'s semantics for loading generators/analyzers differ from VS or the compiling on the CLI so I don't have any hypothesis to this end.
This issue still repro on the latest csharp-1.23.11.vsix, and there appears a "MISSING command" , when click it , says "command missing not found"
The source generator error might suggest that it's because the Razor one is referencing too new a source generator version. By too new, it's the same version as the compiler in the SDK, but O# hasn't picked it up.
Perhaps we should consider pinning this version here: https://github.com/dotnet/sdk/blob/main/src/RazorSdk/SourceGenerators/Microsoft.NET.Sdk.Razor.SourceGenerators.csproj#L15 rather than have it float.
@pranavkm Hmmm. Is there a way for us to know what is considered "too new" my O#?
I'm thinking about scenarios where we want to pick up the most recent version to get a bug fix (like the issues with special characters in filenames) or if we're consuming a new API. It seems a little weird to downgrade for the sake of O# in those scenarios.
The version of the compiler that is referenced by the source generator shouldn't generally matter since you ultimately get the version that it's loaded in. We can target a minimum version that supports all the features we need (for e.g. when we get incremental source generators we can update).
That said it's possible that the reported issue is a point in time issue that goes away once O# is updated. Maybe @JoeRobich might be able to help us understand this better?
That said it's possible that the reported issue is a point in time issue that goes away once O# is updated. Maybe @JoeRobich might be able to help us understand this better?
Agreed. I haven't seen this pop up in a project I'm working on with the latest C# extension.
Starting OmniSharp server at 4/13/2021, 8:10:34 PM
Target: /Users/captainsafia/Verifications/RerenderExplorations
OmniSharp server started.
Path: /Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/run
PID: 66842
[info]: OmniSharp.Stdio.Host
Starting OmniSharp on MacOS 11.2.3 (x64)
[info]: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.9.0 - "/Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to '/Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin/MSBuild.exe'
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.9.0 - "/Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin"
CscToolExe = csc.exe
MSBuildToolsPath = /Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin
CscToolPath = /Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/omnisharp/.msbuild/Current/Bin/Roslyn
BypassFrameworkInstallChecks = true
MSBuildExtensionsPath = /Users/captainsafia/.vscode/extensions/ms-dotnettools.csharp-1.23.11/.omnisharp/1.37.8/omnisharp/.msbuild
[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 '/Users/captainsafia/Verifications/RerenderExplorations'.
[info]: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
[info]: OmniSharp.MSBuild.ProjectSystem
Skip loading projects listed in solution file or under target directory because MsBuild:LoadProjectsOnDemand is true.
[info]: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in '/Users/captainsafia/Verifications/RerenderExplorations'.
[info]: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
[info]: OmniSharp.WorkspaceInitializer
Configuration finished.
[info]: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location '/Users/captainsafia/Verifications/RerenderExplorations' on host 66764.
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: /Users/captainsafia/Verifications/RerenderExplorations/Shared/MainLayout.razor__virtual.cs added to workspace
[info]: OmniSharp.MSBuild.ProjectManager
Queue project update for '/Users/captainsafia/Verifications/RerenderExplorations/RerenderExplorations.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Loading project: /Users/captainsafia/Verifications/RerenderExplorations/RerenderExplorations.csproj
[info]: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file '/Users/captainsafia/Verifications/RerenderExplorations/RerenderExplorations.csproj'.
[info]: OmniSharp.MSBuild.ProjectManager
Adding project '/Users/captainsafia/Verifications/RerenderExplorations/RerenderExplorations.csproj'
[info]: OmniSharp.MSBuild.ProjectManager
Update project: RerenderExplorations
[info]: OmniSharp.Roslyn.CSharp.Services.Diagnostics.CSharpDiagnosticWorkerWithAnalyzers
Solution initialized -> queue all documents for code analysis. Initial document count: 10.
The version of the compiler that is referenced by the source generator shouldn't generally matter since you ultimately get the version that it's loaded in. We can target a minimum version that supports all the features we need (for e.g. when we get incremental source generators we can update).
That said it's possible that the reported issue is a point in time issue that goes away once O# is updated. Maybe @JoeRobich might be able to help us understand this better?
Our current release moved us from using Roslyn 3.9 to 3.10, which is why the error went away.
The NRE from this issue seems to be the same as https://github.com/OmniSharp/omnisharp-roslyn/issues/2125
I have tried this issue in the latest .Net 6.0(Its specific version information is here), and it still reproduces.This is the latest error log as following:
Error Log
Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at OmniSharp.Helpers.LocationExtensions+<>c.2[TSource,TResult].ToArray () [0x00012] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable
1[T] source) [0x0001f] in <17e8581c65f940ca8137dd67206f5dbd>:0
at OmniSharp.Helpers.LocationExtensions.GetQuickFix (Microsoft.CodeAnalysis.Location location, OmniSharp.OmniSharpWorkspace workspace) [0x00128] in 2[TSource,TResult].MoveNext () [0x00048] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Set
1[TElement].UnionWith (System.Collections.Generic.IEnumerable1[T] other) [0x00018] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Enumerable+DistinctIterator
1[TSource].FillSet () [0x0000b] in <17e8581c65f940ca8137dd67206f5dbd>:0
at System.Linq.Enumerable+DistinctIterator1[TSource].ToArray () [0x00000] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Buffer
1[TElement]..ctor (System.Collections.Generic.IEnumerable1[T] source) [0x0000a] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.OrderedEnumerable
1+3[TSource,TMiddle,TResult].<CombineSelectors>b__0 (TSource x) [0x00012] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Enumerable+SelectArrayIterator
2[TSource,TResult].ToArray () [0x00012] in <17e8581c65f940ca8137dd67206f5dbd>:0
at System.Linq.Enumerable.ToArray[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x0001f] in <17e8581c65f940ca8137dd67206f5dbd>:0
at OmniSharp.Helpers.LocationExtensions.GetQuickFix (Microsoft.CodeAnalysis.Location location, OmniSharp.OmniSharpWorkspace workspace) [0x00128] in 2[TSource,TResult].MoveNext () [0x00048] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Set
1[TElement].UnionWith (System.Collections.Generic.IEnumerable1[T] other) [0x00018] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Enumerable+DistinctIterator
1[TSource].FillSet () [0x0000b] in <17e8581c65f940ca8137dd67206f5dbd>:0
at System.Linq.Enumerable+DistinctIterator1[TSource].ToArray () [0x00000] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.Buffer
1[TElement]..ctor (System.Collections.Generic.IEnumerable1[T] source) [0x0000a] in <17e8581c65f940ca8137dd67206f5dbd>:0 at System.Linq.OrderedEnumerable
1+
@NTaylorMullen This issue does not reproduce after installing the pre-release C# (here). Should we close it ?
@NTaylorMullen This issue does not reproduce after installing the pre-release C# (here). Should we close it ?
Oh definitely! Thanks for double checking @v-Lily!
Azure DevOps work item: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1284417
Testcases Affected
[6.0] SimpleWebAppRazorEditingWithVSCode [6.0] SimpleBlazorRazorEditingWithVSCode
Platform
Repro Steps
public interface ICheese {}
above public class Program and saveNote:
Actual Result
CodeLens references numbers did not load and the output window contain error "Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object."
Error Log
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at OmniSharp.Helpers.LocationExtensions.<>c__DisplayClass0_0.b__3(Document d) in D:\a\1\s\src\OmniSharp.Roslyn.CSharp\Helpers\LocationExtensions.cs:line 45
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable
1 source, Func
2 predicate)at OmniSharp.Helpers.LocationExtensions.g__GetSourceText|0_0(Location location, IEnumerable`1 documents, Boolean hasMappedPath) in D:\a\1\s\src\OmniSharp.Roslyn.CSharp\Helpers\LocationExtensions.cs:line 45
at OmniSharp.Helpers.LocationExtensions.GetQuickFix(Location location, OmniSharpWorkspace workspace) in D:\a\1\s\src\OmniSharp.Roslyn.CSharp\Helpers\LocationExtensions.cs:line 19
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.d__64`1.MoveNext()
at System.Linq.Buffer
1..ctor(IEnumerable
1 source)at System.Linq.OrderedEnumerable`1.d__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()