Skip to content

Commit

Permalink
Don't lose the frozen source generated document state
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jasonmalinowski committed Feb 24, 2022
1 parent 9251b4c commit e316c42
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ private SolutionState CreatePrimarySolution(
_filePathToDocumentIdsMap,
_dependencyGraph,
_lazyAnalyzers,
frozenSourceGeneratedDocument: null);
_frozenSourceGeneratedDocumentState);
}

private BranchId GetBranchId()
Expand Down

0 comments on commit e316c42

Please sign in to comment.