You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is blocking microsoft/CsWinRT#1878. It seems that diagnostic suppressors are not invoked at all by Roslyn when targeting IDEXXXX diagnostics. If I take the same exact suppressor and just change the suppressed id to some CSXXXX diagnostic, then it is invoked as expected. When I change it back to IDEXXXX, it stops working again. Interestingly enough, it does run in a unit test, but not in a real project. I tried both when referencing a .dll from a NuGet package, as well as with a local project reference. ReportSuppressions is never called.
Steps to Reproduce:
Use a suppressor like this:
[DiagnosticAnalyzer(LanguageNames.CSharp)]publicsealedclassCollectionExpressionIDE0300Suppressor:DiagnosticSuppressor{publicstaticreadonlySuppressionDescriptorCollectionExpressionIDE0300=new(id:"CsWinRT2001",suppressedDiagnosticId:"IDE0300",justification:"Using collection expressions when targeting 'IEnumerable<T>', 'ICollection<T>', 'IList<T>', 'IReadOnlyCollection<T>', "+"or 'IReadOnlyList<T>', when the collection expression is not empty, is not AOT compatible in WinRT scenarios");/// <inheritdoc/>publicoverrideImmutableArray<SuppressionDescriptor>SupportedSuppressions{get;}=[CollectionExpressionIDE0300];/// <inheritdoc/>publicoverridevoidReportSuppressions(SuppressionAnalysisContextcontext){Debugger.Launch();Debugger.Break();}}
Reference it in a project
Cause the diagnostic to be produced, eg. in this case via:
int[]x=new[]{1,2,3};
Observe that ReportSuppressions is never invoked at all.
I can provide logs or anything else needed.
Expected Behavior:
The suppressor should work as expected.
Actual Behavior:
The suppressor is never invoked at all when targeting IDEXXXX diagnostics.
The text was updated successfully, but these errors were encountered:
Version Used: 4.12.0-3.24558.5 (21192bf)
Overview
This issue is blocking microsoft/CsWinRT#1878. It seems that diagnostic suppressors are not invoked at all by Roslyn when targeting IDEXXXX diagnostics. If I take the same exact suppressor and just change the suppressed id to some CSXXXX diagnostic, then it is invoked as expected. When I change it back to IDEXXXX, it stops working again. Interestingly enough, it does run in a unit test, but not in a real project. I tried both when referencing a .dll from a NuGet package, as well as with a local project reference.
ReportSuppressions
is never called.Steps to Reproduce:
ReportSuppressions
is never invoked at all.I can provide logs or anything else needed.
Expected Behavior:
The suppressor should work as expected.
Actual Behavior:
The suppressor is never invoked at all when targeting IDEXXXX diagnostics.
The text was updated successfully, but these errors were encountered: