I suppose it is. Does .NET call Release on finalizer?

On Fri, Jan 14, 2011 at 4:30 PM, Dick Porter <dpor...@codicesoftware.com>wrote:

> Hi all
>
> I'm currently debugging an issue that appears to be caused by the
> non-release of unmanaged resources in CriticalHandle.  I'm using the git
> master branch.
>
> In CriticalHandle.cs:
>
>                [ReliabilityContract (Consistency.WillNotCorruptState,
> Cer.Success)]
>                ~CriticalHandle ()
>                {
>                        Dispose (false);
>                }
>
>                [ReliabilityContract (Consistency.WillNotCorruptState,
> Cer.Success)]
>                protected virtual void Dispose (bool disposing)
>                {
>                        if (_disposed)
>                                return;
>
>                        _disposed = true;
>                        if (IsInvalid)
>                                return;
>
>                        if (disposing == true && !IsInvalid){
>                                if (!ReleaseHandle ()) {
>                                        GC.SuppressFinalize (this);
>                                } else {
>                                        // Failed in release...
>                                }
>                        }
>                }
>
>
> Unless I'm missing something, this looks to me that when the
> CriticalHandle object is finalized, the unmanaged resources won't be
> released: ReleaseHandle() isn't called.
>
> Is this a bug?
>
> - Dick
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to