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
Within an editorconfig file within a nuget analyzer package, I can for example set:
dotnet_diagnostic.CA5394.severity = Warning
and then within code using that analyzer package, Random.Shared.Next(n) becomes a compilation error. But there is a problem, it's not really an error, it's a warning being treated as an error. As such, #pragma warning disable CA5394 can be used to suppress this "error".
It would be very useful - especially for security rules - to be able to specify they are true errors that cannot be supressed via #pragma warning disable, <NoWarn/> and the like. This would be a breaking change if the behaviour of analyzer rules set to Error were changed though. So maybe this could be addressed via a new TrueErrror state for the severity for example, which would make it genuinely an error, rather than a warning being treated as an error.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Within an editorconfig file within a nuget analyzer package, I can for example set:
dotnet_diagnostic.CA5394.severity = Warning
and then within code using that analyzer package,
Random.Shared.Next(n)
becomes a compilation error. But there is a problem, it's not really an error, it's a warning being treated as an error. As such,#pragma warning disable CA5394
can be used to suppress this "error".It would be very useful - especially for security rules - to be able to specify they are true errors that cannot be supressed via
#pragma warning disable
,<NoWarn/>
and the like. This would be a breaking change if the behaviour of analyzer rules set to Error were changed though. So maybe this could be addressed via a newTrueErrror
state for the severity for example, which would make it genuinely an error, rather than a warning being treated as an error.Beta Was this translation helpful? Give feedback.
All reactions