I attempted to follow steps from https://github.com/dotnet/roslyn/issues/26778 for my recent PR https://github.com/dotnet/roslyn/pull/28918, and found that the following command line leads to empty document optionset for the analyzer (and hence 0 diagnostics as analyzer bails out early), possibly because the analyzer is fully implemented in the core Features layer, while the options are in C# and VB specific assemblies:
Finally, I ended up doing the following workaround to define analyzers in each language specific assemblies, and this time it worked and analyzer reported the expected set of diagnostics:
//[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)]
internal abstract class MakeFieldReadonlyDiagnosticAnalyzer
: AbstractCodeStyleDiagnosticAnalyzer
Namespace Microsoft.CodeAnalysis.VisualBasic.MakeFieldReadonly
<DiagnosticAnalyzer(LanguageNames.VisualBasic)>
Friend Class VisualBasicMakeFieldReadonlyDiagnosticAnalyzer
Inherits MakeFieldReadonlyDiagnosticAnalyzer
End Class
End Namespace
I attempted to follow steps from https://github.com/dotnet/roslyn/issues/26778 for my recent PR https://github.com/dotnet/roslyn/pull/28918, and found that the following command line leads to empty document optionset for the analyzer (and hence 0 diagnostics as analyzer bails out early), possibly because the analyzer is fully implemented in the core Features layer, while the options are in C# and VB specific assemblies:
I also attempted to use a different command line by creating a separate folder
Analyzers
with all 3 Features assemblies, but still hit the same issue:Finally, I ended up doing the following workaround to define analyzers in each language specific assemblies, and this time it worked and analyzer reported the expected set of diagnostics: