Skip to content

Commit aa13c48

Browse files
committed
Revert change to get the compilation once during ModifyAllReferencesAsync
This change caused incorrect behavior since the document ids can come from projects other than the source project (namely the test project). This broken when semantic models were requested for test project documents from the source project compilation.
1 parent 00d83bc commit aa13c48

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

sources/SilkTouch/SilkTouch/Mods/LocationTransformation/LocationTransformationUtils.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ public static async Task ModifyAllReferencesAsync(
4545
];
4646

4747
var originalSolution = sourceProject.Solution;
48-
var compilation = await sourceProject.GetCompilationAsync(ct);
49-
if (compilation == null)
50-
{
51-
return;
52-
}
53-
5448
var newDocuments = new ConcurrentDictionary<DocumentId, SyntaxNode>();
5549
var symbolSet = new HashSet<ISymbol>(symbols, SymbolEqualityComparer.Default);
5650
var baseRewriter = new LocationTransformationRewriter(symbolSet, transformers.ToList());
@@ -66,13 +60,12 @@ await Parallel.ForEachAsync(
6660
}
6761

6862
var originalRoot = await originalDocument.GetSyntaxRootAsync(ct);
69-
if (originalRoot == null)
63+
var semanticModel = await originalDocument.GetSemanticModelAsync(ct);
64+
if (originalRoot == null || semanticModel == null)
7065
{
7166
return;
7267
}
7368

74-
var semanticModel = compilation.GetSemanticModel(originalRoot.SyntaxTree);
75-
7669
// Since this is multithreaded, each thread needs their own copy of the rewriter and transformers
7770
var rewriter = baseRewriter.GetThreadSafeCopy();
7871

0 commit comments

Comments
 (0)