Open ashmind opened 7 years ago
Submitted this by mistake before filling in details, so closed at first -- then realized I can reopen after filling.
Removed link to SharpLab demo: it now uses reflection to create WorkspaceAnalyzerOptions
so the bug doesn't apply anymore.
@chborl For now, we should probably bail if we can't get the WorkspaceAnalyzerOptions. @ashmind Is this the only one you're encountering problems with?
@dpoeschl Yes, that's the only one. Though I needed CSharpRemoveUnnecessaryImportsDiagnosticAnalyzer
from #16644, so I created WorkspaceAnalyzerOptions
with reflection and now I don't have this problem either.
Would be great if it didn't require reflection though.
Version Used:
master
branch, 1a36abc673dcba88c79f6b769c9722f56f5c9f63Steps to Reproduce:
Unfortunately I can't reproduce it with NuGet versions, and a I don't have time to build a test case on top of
master
. However I'm sure example at #16644 should be able to reproduce it if run againstmaster
(withSourceText
updated as per step 2).AdHocWorkspace
or another custom workspaceConsole.WriteLine()
:compilation.WithAnalyzers().GetAllDiagnosticsAsync()
Expected Behavior: There are no diagnostics produced as the code is valid.
Actual Behavior: There is one diagnostic:
Technical Notes: Looking at the code in https://github.com/dotnet/roslyn/blob/5632597039206c667e2cfb145988739acf7a5379/src/Features/Core/Portable/ValidateFormatString/AbstractValidateFormatStringDiagnosticAnalyzer.cs#L82-L85 it seems similar to the problem in #16644: https://github.com/dpoeschl/roslyn/commit/6375c4d2ff159d56edca0563ea21aec7221cdc89#diff-203dcb8c3cb1796c2a260bc8d40f03b4R21.