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

Crash in compilation tracker source generator handling. #57082

Closed
CyrusNajmabadi opened this issue Oct 11, 2021 · 0 comments · Fixed by #59723
Closed

Crash in compilation tracker source generator handling. #57082

CyrusNajmabadi opened this issue Oct 11, 2021 · 0 comments · Fixed by #59723
Assignees
Labels
Area-IDE Bug Tenet-Reliability Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner.

Comments

@CyrusNajmabadi
Copy link
Member

CyrusNajmabadi commented Oct 11, 2021

🔗 Also reported internally as AB#1438489

StreamJsonRpc.RemoteInvocationException: The method or operation is not implemented.
   at StreamJsonRpc.JsonRpc.<InvokeCoreAsync>d__139`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.CodeAnalysis.Remote.BrokeredServiceConnection`1.<TryInvokeAsync>d__18`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
RPC server exception:
System.NotImplementedException: The method or operation is not implemented.
      at Microsoft.CodeAnalysis.SolutionState.GeneratedFileReplacingCompilationTracker.Fork(ProjectState newProject, CompilationAndGeneratorDriverTranslationAction translate, CancellationToken cancellationToken)
      at Microsoft.CodeAnalysis.SolutionState.ForkProject(ProjectState newProjectState, CompilationAndGeneratorDriverTranslationAction translate, ProjectDependencyGraph newDependencyGraph, ImmutableDictionary`2 newFilePathToDocumentIdsMap, Boolean forkTracker)
      at Microsoft.CodeAnalysis.SolutionState.UpdateDocumentState(DocumentState newDocument, Boolean textChanged, Boolean recalculateDependentVersions)
      at Microsoft.CodeAnalysis.Solution.WithDocumentText(DocumentId documentId, SourceText text, PreservationMode mode)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.<UpdateDocumentAsync>d__13.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.<UpdateDocumentsAsync>d__12.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.<UpdateProjectAsync>d__10.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.<UpdateProjectsAsync>d__8.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.<UpdateProjectsAsync>d__7.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.SolutionCreator.<CreateSolutionAsync>d__6.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteWorkspace.<<GetProjectSubsetSolutionAsync>g__GetProjectSubsetSolutionSlowAsync|15_0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at Microsoft.CodeAnalysis.Remote.RemoteNavigationBarItemService.<>c__DisplayClass2_0.<<GetItemsAsync>b__0>d.MoveNext()
   --- End of stack trace from previous location where exception was thrown ---
      at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
      at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
      at System.Threading.Tasks.ValueTask`1.get_Result()
      at Microsoft.CodeAnalysis.Remote.BrokeredServiceBase.<RunServiceImplAsync>d__13`1.MoveNext()
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 11, 2021
@jasonmalinowski jasonmalinowski modified the milestones: 17.0, 17.1 Oct 11, 2021
@jinujoseph jinujoseph added Bug Tenet-Reliability Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner. and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 13, 2021
@jinujoseph jinujoseph modified the milestones: 17.1, 17.1.P1 Oct 13, 2021
@jasonmalinowski jasonmalinowski modified the milestones: 17.1.P1, 17.2 Jan 5, 2022
jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Feb 24, 2022
In this particular code path, we were passing null for the frozen
source generated document state when we could have passed it along.
The original logic here was frozen source generated documents only
normally appear when somebody calls
ITextSnapshot.GetOpenDocumentInCurrentContextWithChanges, since we need
to ensure that there is a generated document with that exact snapshot
for the feature to work. We should never see that in a "primary"
solution in any way. However, solution sync uses CurrentSolution as
a cache for the previously synced complete solution, which meant
we'd still end up calling this anyways.

Although we could (and probably should) avoid caching these special
solutions entirely, this avoids any surprises here and makes things
behave like normal, and avoids odd cases where the CompilationTrackers
are out of sync with this field.

This partially addresses dotnet#57082
jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Feb 24, 2022
The previous assumption in this code was incorrect -- we absolutely
can end up with a frozen generated document in CurrentSolution,
since the remote workspace caches things there. We're going to just
run with that and consider that normal, so we'll fix up the code to
support it cleanly.

Fixes dotnet#57082
Fixes dotnet#56998
jasonmalinowski added a commit to jasonmalinowski/roslyn that referenced this issue Feb 24, 2022
When we are synchronizing solutions, the previous assumption in this
code was incorrect -- we absolutely can end up with a frozen generated
document in CurrentSolution, since the remote workspace caches things
there. We're going to just run with that and consider that normal, so
we'll fix up the code to support it cleanly.

Fixes dotnet#57082
Fixes dotnet#56998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE Bug Tenet-Reliability Customer telemetry indicates that the product is failing in a crash/hang/dataloss manner.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants