✅ How come this gives me no warning in Rider?
For context, I have this in MSBuild
And this in .editorconfig
What else do I have to do to make it work?
23 Replies
Unused variables also don't count as errors. Why does that happen, even with AnalysisLevel preview
What makes you think that you should get a diagnostic there?
Neither CA1001 or CA1816 should fire there
No the code I sent should trigger an IDisposable warning
(Note that it's no longer recommended to implement a finalizer in your IDisposable types in almost all cases, and so SuppressFinalize is irrelevant)
Unused variables is a different issue
Just related
What makes you think so? CA1001 isn't relevant to that code
"own" means the IDisposable member is a field
Ah shit you're right
And it's about implementing IDisposable, not about calling Dispose on variables/fields
CA2000: Dispose objects before losing scope (code analysis) - .NET
Learn about code analysis rule CA2000: Dispose objects before losing scope
Still ignored
Maybe because it's a Stream?
No I tested it on a custom type
i dont know about preview but try to set AnalysisLevel to all
as in the docs mentioned its not enabled by default...
There's no such thing
Wut?
C:\Program Files\dotnet\sdk\8.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.Analyzers.targets(69,18): error MSB4184: The expres
sion "[MSBuild]::VersionGreaterThanOrEquals(all, 5.0)" cannot be evaluated. Version string was not in a correct format.
mom
Ah yeah, you're thinking of AnalysisMode
MSBuild properties for Microsoft.NET.Sdk - .NET
Reference for the MSBuild properties and items that are understood by the .NET SDK.
Oh yeah that produced a pile of warnings
nice
But still none in the ide
Re-run analysis?
btw its not enabled by default for a reason.. you are gonna catch quite a few false positives