Skip to content

Commit

Permalink
Fix analyzers
Browse files Browse the repository at this point in the history
  • Loading branch information
thomhurst committed Dec 4, 2024
1 parent ff6d79e commit 5238aff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion TUnit.Analyzers/Extensions/SyntaxExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class SyntaxExtensions
{
public static IOperation? GetOperation(this SyntaxNode syntaxNode, SemanticModel semanticModel)
{
if (semanticModel.SyntaxTree != syntaxNode.SyntaxTree)
if (semanticModel.SyntaxTree != syntaxNode.SyntaxTree && semanticModel.Compilation.ContainsSyntaxTree(syntaxNode.SyntaxTree))
{
semanticModel = semanticModel.Compilation.GetSemanticModel(syntaxNode.SyntaxTree);
}
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Core.SourceGenerator/Extensions/SyntaxExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class SyntaxExtensions
{
public static ISymbol? GetSymbolInfo(this SyntaxNode syntaxNode, SemanticModel semanticModel)
{
if (semanticModel.SyntaxTree != syntaxNode.SyntaxTree)
if (semanticModel.SyntaxTree != syntaxNode.SyntaxTree && semanticModel.Compilation.ContainsSyntaxTree(syntaxNode.SyntaxTree))
{
semanticModel = semanticModel.Compilation.GetSemanticModel(syntaxNode.SyntaxTree);
}
Expand Down

0 comments on commit 5238aff

Please sign in to comment.