-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix couple of analyzer bugs #967
Conversation
…eport diagnostics on generated code. Fixes dotnet#949 Seems like invoking analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze), which should suppress all diagnostics on generated code, still allows the analyzer to report compilation end diagnostics on generated code. I'll file a separate bug on roslyn repo to fix the driver.
Tagging @dotnet/roslyn-analysis for review |
👍 |
@mavasani Did you already file a separate bug on roslyn repo to fix the driver? I have looked around in the source of AnalyzerDriver / AnalyzerExecutor and believe there is no easy way to get this working.
So I don't see an obvious way for the driver/executor to determine whether a symbol, syntax node, tree or operation comes from generated code in the Compilation End analysis. |
@bkoelman I'll file it now. Note that we do the generated code filtering for reported diagnostics based on its primary location, not based on what context it was reported. See this method: http://source.roslyn.io/#Microsoft.CodeAnalysis/DiagnosticAnalyzer/AnalyzerDriver.cs,303. We just need to fix this method to add this if check to do this filtering for compilation diagnostics, we seem to be doing it only for non-compilation diagnostics. |
Opened dotnet/roslyn#11217 |
@mavasani Yes you are correct. I see now how I got on the wrong track by looking at |
Fixes CA2222 (DoNotDecreaseInheritedMemberVisibility) fires on members with resultant accessiblity private/internal #940
Fixes TypeNamesShouldNotMatchNamespaces (CA1724) reports on WinForms designer-generated code #949
Seems like invoking
analysisContext.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze)
, which should suppress all diagnostics on generated code, still allows the analyzer to report compilation end diagnostics on generated code. I'll file a separate bug on roslyn repo to fix the driver.