dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19k stars 4.03k forks source link

Public API Analyzer is crashing with "Nullable reference analysis IDE features" enabled #36003

Open AlekseyTs opened 5 years ago

AlekseyTs commented 5 years ago
System.AggregateException : One or more errors occurred. ---> Object reference not set to an instance of an object.
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.InvokeWorker(Func`1 getFromDocument,IProgressTracker progressTracker,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<>c__DisplayClass17_0.<InvokeCore>b__0()
   at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.PerformAction(IExtensionManager extensionManager,Object extension,Action action)
---> (Inner Exception #0) System.NullReferenceException : Object reference not set to an instance of an object.
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioWorkspaceImpl.ApplyTextDocumentChange(DocumentId documentId,SourceText newText)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioWorkspaceImpl.ApplyAdditionalDocumentTextChanged(DocumentId documentId,SourceText newText)
   at Microsoft.CodeAnalysis.Workspace.ApplyProjectChanges(ProjectChanges projectChanges)
   at Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Solution newSolution,IProgressTracker progressTracker)
   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioWorkspaceImpl.TryApplyChanges(Solution newSolution,IProgressTracker progressTracker)
   at Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.TryApply(Workspace workspace,IProgressTracker progressTracker,CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.CodeActions.ApplyChangesOperation.Apply(Workspace workspace,CancellationToken cancellationToken)
   at async Microsoft.CodeAnalysis.Editor.Implementation.CodeActions.CodeActionEditHandlerService.ApplyAsync(<Unknown Parameters>)<---

CC @333fred, @jasonmalinowski

jasonmalinowski commented 5 years ago

@AlekseyTs That looks like #35300 which we fixed recently and not related to nullability. Which VS version are you using?

AlekseyTs commented 5 years ago

VisualStudio.16.IntPreview/16.2.0-pre.2.0+28921.361.d16.2stg

It worked once I disabled the checkbox in the properties. Feels like there is some correlation.