[Mono-dev] What will happen if Dispose() hangs?

Robert Jordan robertj at gmx.net
Tue Jan 27 16:11:36 UTC 2015


On 27.01.2015 15:46, Edward Ned Harvey (mono) wrote:
>
> The question still stands about what happens if Dispose() hangs during garbage collection...
>

You may want to look up how a sane IDisposable pattern has to be 
sensibly implemented in .NET. You'll find out that Dispose()
shouldn't be called from a finalizer.

A blocking finalizer will hang the GC, but it looks like SslStream is
implementing finalization correctly:

https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Security/SslStream.cs#L516

https://github.com/mono/mono/blob/master/mcs/class/System/System.Net.Security/AuthenticatedStream.cs#L78

Robert




More information about the Mono-devel-list mailing list