Skip to content

Commit 19a8d65

Browse files
committed
Merge pull request #1523 from pdelvo/1501workaround
Implement a workaround for #1501
2 parents f3ddc0e + fac59f2 commit 19a8d65

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

StyleCop.Analyzers/StyleCop.Analyzers/ReadabilityRules/SA1101PrefixLocalCallsWithThis.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,20 @@ private static void HandleIdentifierNameImpl(SyntaxNodeAnalysisContext context,
189189
{
190190
return;
191191
}
192+
193+
// This is a workaround for https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1501 and can
194+
// be removed when the underlying bug in roslyn is resolved
195+
if (nameExpression.Parent is MemberAccessExpressionSyntax)
196+
{
197+
var parentSymbol = context.SemanticModel.GetSymbolInfo(nameExpression.Parent, context.CancellationToken).Symbol as IFieldSymbol;
198+
199+
if (parentSymbol.IsStatic && parentSymbol.ContainingType.Name == symbol.Name)
200+
{
201+
return;
202+
}
203+
}
204+
205+
// End of workaround
192206
}
193207

194208
// Prefix local calls with this

0 commit comments

Comments
 (0)