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
A common mistake when implementing IDisposable is including an unnecessary finalizer. The proposed diagnostic would identify finalizers with the following form:
~ClassName(){
Dispose(false);}
It would then examine the methods called by Dispose(bool) method within that class.
Ignore any block of code guarded by if (disposing), where disposing is the first parameter to Dispose(bool).
Ignore any call to IDisposable.Dispose.
If any method calls are remaining after the above steps, do not report the diagnostic.
The message reported by the diagnostic might have the name UnnecessaryFinalizer and a message like the following:
Unnecessary user-defined finalizers should be removed.
Code Fix
The code fix for the above diagnostic is to simply remove the user-defined finalizer.
The text was updated successfully, but these errors were encountered:
Diagnostic
A common mistake when implementing
IDisposable
is including an unnecessary finalizer. The proposed diagnostic would identify finalizers with the following form:It would then examine the methods called by
Dispose(bool)
method within that class.if (disposing)
, wheredisposing
is the first parameter toDispose(bool)
.IDisposable.Dispose
.If any method calls are remaining after the above steps, do not report the diagnostic.
The message reported by the diagnostic might have the name UnnecessaryFinalizer and a message like the following:
Code Fix
The code fix for the above diagnostic is to simply remove the user-defined finalizer.
The text was updated successfully, but these errors were encountered: