-
Notifications
You must be signed in to change notification settings - Fork 256
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
Obsoletion diagnostic IDs (SYSLIB0xxx) get filtered out in CodeFixTest leading to Exception #1117
Comments
@mpidash this should now be fixed! |
@sharwell Thanks, works like a charm, thanks for fixing this! Do you know when this will be added to |
@mpidash As soon as someone sends a PR to update this line: It would need to use version 1.1.2-beta1.23509.1 or newer. |
@sharwell I tried to set the version locally to |
Looks like there is some outage in the publication pipeline. Hoping it's published soon. |
Hey @mpidash thank you for filing this issue, great to see it is fixed. How is it going with the fixer implementation? Have you seen this PR dotnet/roslyn-analyzers#7043? Would you like to give any feedback there? |
@buyaa-n I have a fixer that uses the new SDK (so no additional analyzer needed) with basic tests. I stopped working on it when I saw the PR from @CollinAlpert. I will have a look at it 👍 |
I am writing a fixer that replaces an obsolete call (for dotnet/runtime#27997) that fixes a diagnostic ID starting with
SYSLIB0
generated by the compiler by specifyingObsoleteAttribute
with a customDiagnosticId
.I used
Microsoft.CodeAnalysis.Testing.EmptyDiagnosticAnalyzer
for testing, as I only provide a fixer, but when running my tests an exception is thrown:I looked into it a bit and found out that only compiler diagnostic IDs starting with
CS
orBC
are passed toCreateFixAllContext
resulting inrelevantIds
being empty because the compiler generatedSYSLIB0xxx
is filtered out andMicrosoft.CodeAnalysis.Testing.EmptyDiagnosticAnalyzer
does not declare supported diagnostics:roslyn-sdk/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.CodeFix.Testing/CodeFixTest`1.cs
Lines 830 to 834 in 6535e67
I was wondering if also adding diagnostic IDs starting with
SYSLIB0
(orSYSLIB
) is possible (and does not affect existing analyzer tests). The workaround is to create a dummy analyzer that declares the diagnostic ID, something like this:The text was updated successfully, but these errors were encountered: