[Mono-dev] WeakReference problem

Rodrigo Kumpera kumpera at gmail.com
Wed Jan 29 22:41:49 UTC 2014


Please provide a test case that shows this behavior


On Wed, Jan 29, 2014 at 5:00 PM, Tobias Käs <tobias.kaes at gmx.de> wrote:

> Hi, the generic WeakReference<T> for .NET 4.5 sometimes returns true from
> TryGetTarget even though the target has been collected (the out-value is
> correctly set to null). All my WeakReferences have been initialized with
> non-null values.
>
> Looking at the source at github I can imagine that there is a race between
> the handle.IsAllocated check and the handle.Target retrieval, but I'm no
> expert. Should I file a bug on that one? I'm not sure what the expected
> behavior is since MSDN documentation of that method isn't so great, but if
> the caller has to check the out-value against null anyways, then the return
> value becomes kinda pointless in my opinion.
>
> Regards,
> Tobias
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140129/218bd453/attachment.html>


More information about the Mono-devel-list mailing list