[Mono-dev] Bad usage of GCHandleType.Pinned
rokumper at microsoft.com
Thu Nov 10 16:56:09 UTC 2016
It came to my attention that mono is a bit more liberal in what objects it allows a pinned gc handle to be created. Dotnet only allows pinned handles to blitable types as it doesn't expose unprotected heap pointers to unsafe code.
There's a PR fixing this but I'm wary on merging it before addressing this issue on, at least, the Xamarin platform.
I've identified problems in Macios and WebSharp (tons more on websharp).
Additionally, I identified a lot of code in both macios and android that would lead to heap corruption if
My suggestion is that we address issues like  and  as  is fine for correct usage of the code.
Enforce restrictions on pinned GCHandle objects by joshpeterson · Pull Request #3929 · mono/mono<https://github.com/mono/mono/pull/3929>
A pinned GCHandle should not be allowed for some types. The GCHandle.Alloc method should throw an ArgumentException in these cases. This change corrects bug https://bugzilla.xamarin.com/show_bug.cg...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list