提交 1462fe1e 编写于 作者: P Paul Harrington

Avoid calling .Locations on namespaces

上级 3136749b
......@@ -67,6 +67,11 @@ public void OnIdentifier(SyntaxNodeAnalysisContext context)
context.CancellationToken.ThrowIfCancellationRequested();
var info = context.SemanticModel.GetSymbolInfo(context.Node, context.CancellationToken);
if (info.Symbol?.Kind == SymbolKind.Namespace)
{
// Avoid getting Locations for namespaces. That can be very expensive.
return;
}
var hasLocations = info.Symbol?.OriginalDefinition?.Locations.Length > 0;
if (!hasLocations)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册