[reflection] Don't crash when building dynamic custom attributes on dynamic types...
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Mon, 15 Aug 2016 19:05:14 +0000 (15:05 -0400)
committerGitHub <noreply@github.com>
Mon, 15 Aug 2016 19:05:14 +0000 (15:05 -0400)
commit694b115595bb12688a1ad1de18868e5c837dd6df
treeb86265fffa1f5978729f3b4a955e00180dae4cfd
parente4a17068f503565b81645f50e91049d3f9a63751
[reflection] Don't crash when building dynamic custom attributes on dynamic types (Fixes #43291) (#3399)

* [corlib] Regression test for non-visible custom attributes.

See https://bugzilla.xamarin.com/show_bug.cgi?id=43291

* [reflection] Don't crash when building dynamic custom attributes on dynamic types (Fixes #43291)

1. Don't dereference a NULL custom attribute ctor, throw a type load
   exception.
2. When building MonoCustomAttrInfo from an array of
   MonoReflectinoCustomAttr*, compute the number of
   non-visible (non-public) attributes correctly, and make sure to
   iterate over all the attributes when populating the result array.

Fixes [#43291](https://bugzilla.xamarin.com/show_bug.cgi?id=43291)

* [reflection] Marginally better TLE for custom attrs

At least include a message about what went wrong when trying to
construct a custom attribute from a type that isn't finished yet.
mcs/class/corlib/Test/System.Reflection.Emit/CustomAttributeBuilderTest.cs
mono/metadata/reflection.c