Merge pull request #2714 from lambdageek/dev/monoerror-mono_reflection_type_get_handle
authormonojenkins <jo.shields+jenkins@xamarin.com>
Fri, 4 Mar 2016 22:00:19 +0000 (22:00 +0000)
committermonojenkins <jo.shields+jenkins@xamarin.com>
Fri, 4 Mar 2016 22:00:19 +0000 (22:00 +0000)
[reflection] MonoError for mono_reflection_type_get_handle

`mono_reflection_type_get_handle` is really a kind of normalization procedure that synthesizes real `MonoType`s from reflection's derived types such as `System.Reflection.Emit.ArrayType, ByRefType`, etc.  So we call it all over the place in System.Reflection.Emit runtime code.

That would all be fine, except that users are allowed to subclass `System.Type`, so we have to call the `UnderlyingSystemType()` method to get a real type.  Which means that an override can throw.  Which in coop mode means we have to thread around a `MonoError`.  So that's why this code is uglier.

But really this code is doing a lot of type inspection and high-level work that we should figure out how to migrate to managed.

1  2 
mono/metadata/object-internals.h

Simple merge