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
{{ message }}
Repository navigation
CA1416 doesn't work when Microsoft.CodeAnalysis.NetAnalyzers is referenced directly with EnableNETAnalyzers=false #53125
When a project has a dependency on Microsoft.CodeAnalysis.NetAnalyzersv10.0.103 and EnableNETAnalyzers is set to false, CA1416 warnings aren't being triggered when they should (reproduction code).
This didn't use to be the case with Microsoft.CodeAnalysis.NetAnalyzersv8.0.0. In fact, adding a dependency on Microsoft.CodeAnalysis.NetAnalyzersv8.0.0 used to set EnableNETAnalyzers to false to prevent collisions between the SDK's built-in analyzers and the package-provided ones.
I believe that this should be tagged as Microsoft.CodeAnalysis.NetAnalyzers
Not sure about that, given this is about the property EnableNETAnalyzers, it might be more "SDK area" rather than "analyzers area", but added the label anyway.
I believe that the issue could be related to the packaging of Microsoft.CodeAnalysis.NetAnalyzers nuget. I further nailed down the breakage as happening between 10.0.0-preview.25380.108 (produces the warning correctly) and 10.0.100-rc.1.25451.107 (doesn't produce it anymore). The preview version has additional directories like "buildTransitive", "rulesets" and others, while the RC version does not:
I've had some more time to spend on this, and found that what's stopping CA1416 from working are some missing CompilerVisibleProperty items which used to be set by buildTransitive/Microsoft.CodeAnalysis.NetAnalyzers.targets.
@KalleOlaviNiemitalo And I fully support your relaxation :)
I don't know who has what permissions, and was just trying to get some eyeballs on this issue from people involved with Roslyn analyzers.
Thank you for confirming. I see you've added the 11.x milestone. Will this not be fixed in 10.x? It's at least one analyzer completely broken, potentially more.
Also, is something going to be done to address the lack of testing in this area? This isn't exactly a subtle bug, and could have easily been caught.
Activity
amaltinsky commentedon Feb 24, 2026
I believe that this should be tagged as
Microsoft.CodeAnalysis.NetAnalyzersamaltinsky commentedon Mar 2, 2026
@jjonescz @CyrusNajmabadi @KalleOlaviNiemitalo
jjonescz commentedon Mar 2, 2026
Not sure about that, given this is about the property
EnableNETAnalyzers, it might be more "SDK area" rather than "analyzers area", but added the label anyway.amaltinsky commentedon Mar 2, 2026
@jjonescz
Thanks for that.
I believe that the issue could be related to the packaging of
Microsoft.CodeAnalysis.NetAnalyzersnuget. I further nailed down the breakage as happening between10.0.0-preview.25380.108(produces the warning correctly) and10.0.100-rc.1.25451.107(doesn't produce it anymore). The preview version has additional directories like "buildTransitive", "rulesets" and others, while the RC version does not:amaltinsky commentedon Mar 4, 2026
I've had some more time to spend on this, and found that what's stopping CA1416 from working are some missing
CompilerVisiblePropertyitems which used to be set bybuildTransitive/Microsoft.CodeAnalysis.NetAnalyzers.targets.KalleOlaviNiemitalo commentedon Mar 4, 2026
@amaltinsky if you were expecting me to label this issue — I don't have access. And I feel more relaxed that way.
amaltinsky commentedon Mar 4, 2026
@KalleOlaviNiemitalo And I fully support your relaxation :)
I don't know who has what permissions, and was just trying to get some eyeballs on this issue from people involved with Roslyn analyzers.
cremor commentedon May 12, 2026
Related: #54046
jeffhandley commentedon Aug 23, 2026
Thanks for reporting this, @amaltinsky. I've confirmed this was indeed regressed in .NET 10.
amaltinsky commentedon Aug 27, 2026
Hi @jeffhandley
Thank you for confirming. I see you've added the 11.x milestone. Will this not be fixed in 10.x? It's at least one analyzer completely broken, potentially more.
Also, is something going to be done to address the lack of testing in this area? This isn't exactly a subtle bug, and could have easily been caught.