in ComObject.cs [206:234]
protected unsafe override void Dispose(bool disposing)
{
// Only dispose non-zero object
if (NativePointer != IntPtr.Zero)
{
// If object is disposed by the finalizer, emits a warning
if(!disposing && Configuration.EnableTrackingReleaseOnFinalizer)
{
if(!Configuration.EnableReleaseOnFinalizer)
{
var objectReference = ObjectTracker.Find(this);
LogMemoryLeakWarning?.Invoke(string.Format("Warning: Live ComObject [0x{0:X}], potential memory leak: {1}", NativePointer.ToInt64(), objectReference));
}
}
// Release the object
if (disposing || Configuration.EnableReleaseOnFinalizer)
((IUnknown)this).Release();
// Untrack the object
if (Configuration.EnableObjectTracking)
ObjectTracker.UnTrack(this);
// Set pointer to null (using protected members in order to avoid NativePointerUpdat* callbacks.
_nativePointer = (void*)0;
}
base.Dispose(disposing);
}