This documentation is archived and is not being maintained.
Dispose methods should call base class dispose
A type that implements System.IDisposable inherits from a type that also implements IDisposable. The Dispose method of the inheriting type does not call the Dispose method of the parent type.
If a type inherits from a disposable type, it must call the Dispose method of the base type from within its own Dispose method.
To fix a violation of this rule, call base.Dispose in your Dispose method.
It is safe to exclude a warning from this rule if the call to base.Dispose occurs at a deeper calling level than the rule checks.
The following example shows a type TypeA that implements IDisposable.
public class TypeA :IDisposable
protected virtual void Dispose(bool disposing)
// Dispose managed resources
// Free native resources
public void Dispose()
// Disposable types implement a finalizer.
The following example shows a type TypeB that inherits from type TypeA and correctly calls its Dispose method.
Public Class TypeB
Friend Overrides Sub Dispose(ByVal disposing As Boolean)
End Sub 'Dispose
End Class 'TypeB