提交 0cc0433a 编写于 作者: S Sam Harwell

Suppress RS1030 where no other option is available

上级 1ad42b9d
......@@ -215,7 +215,9 @@ private void SyntaxNodeAction(SyntaxNodeAnalysisContext context)
var updatedCompilation = semanticModel.Compilation.ReplaceSyntaxTree(
semanticModel.SyntaxTree, updatedSyntaxTree);
#pragma warning disable RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
return updatedCompilation.GetSemanticModel(updatedSyntaxTree);
#pragma warning restore RS1030 // Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
}
private SyntaxNode GetContainer(BinaryExpressionSyntax isExpression)
......
......@@ -172,7 +172,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseAutoProperty
For Each ref In containingType.DeclaringSyntaxReferences
Dim containingNode = ref.GetSyntax(cancellationToken)?.Parent
If containingNode IsNot Nothing Then
#Disable Warning RS1030 ' Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
Dim semanticModel = compilation.GetSemanticModel(containingNode.SyntaxTree)
#Enable Warning RS1030 ' Do not invoke Compilation.GetSemanticModel() method within a diagnostic analyzer
If IsWrittenOutsideOfConstructorOrProperty(field, propertyDeclaration, containingNode, semanticModel, cancellationToken) Then
Return False
End If
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册