Open Youssef1313 opened 1 year ago
A symbol start/stop analyzer would allow all non-partial types to only evaluate this block of code once (non-partial types only have one SourceTree
).
It would also allow all partial types where at most one part is not considered generated code to evaluate this block of code once (the analyzer uses GeneratedCodeAnalysisFlags.None
so even if we use the wrong configured suffixes and end up reporting a diagnostic in generated code, that diagnostic will be ignored).
https://github.com/dotnet/roslyn-analyzers/blob/9653f963f44ab15d64e8131ed8240c249d3cb84d/src/NetAnalyzers/Core/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/IdentifiersShouldNotHaveIncorrectSuffix.cs#L252
There is an in-progress work in dotnet/roslyn by @sharwell to improve this. (see https://github.com/dotnet/roslyn/issues/68710#issuecomment-1612015378)
However, we are unlikely to be able to consume the new API since we are still stuck in 3.x here.
Is there a way to reduce the number of calls to this API by refactoring the analyzer itself?