Assert.IsFalse (typeof (bug82431B4).IsDefined (typeof (NotInheritAttribute), true), "#K4");
}
+ class Bug13767Attribute : Attribute
+ {
+ public object[] field;
+
+ public Bug13767Attribute (params object[] args)
+ {
+ field = args;
+ }
+ }
+
+ public enum Bug13767Enum
+ {
+ Value0,
+ Value1,
+ }
+
+ [Bug13767("Demo", new[] { Bug13767Enum.Value1, Bug13767Enum.Value0 })]
+ public void Bug13767Method(string attributeName, MyEnum[]options)
+ {
+
+ }
+
+ [Test] //Bug 13767
+ public void CustomAttributeWithNestedArrayOfEnum ()
+ {
+ var m = GetType ().GetMethod ("Bug13767Method");
+
+ var attr = m.GetCustomAttributes (false);
+ Assert.AreEqual (1, attr.Length, "#1");
+
+ var tc = (Bug13767Attribute)attr[0];
+ Assert.AreEqual (2, tc.field.Length, "#2");
+ Assert.AreEqual ("Demo", tc.field[0], "#3");
+ Assert.IsNotNull (tc.field[1], "#4");
+
+ var arr = (Bug13767Enum[])tc.field [1];
+ Assert.AreEqual (2, arr.Length, "#5");
+ Assert.AreEqual (Bug13767Enum.Value1, arr [0], "#6");
+ Assert.AreEqual (Bug13767Enum.Value0, arr [1], "#7");
+ }
+
[Test] // GetType (String)
public void GetType1_TypeName_Null ()
{
return token;
}
+static MonoClass*
+load_cattr_enum_type (MonoImage *image, const char *p, const char **end)
+{
+ char *n;
+ MonoType *t;
+ int slen = mono_metadata_decode_value (p, &p);
+ n = g_memdup (p, slen + 1);
+ n [slen] = 0;
+ t = mono_reflection_type_from_name (n, image);
+ if (!t)
+ g_error ("Cannot load type '%s'", n);
+ g_free (n);
+ p += slen;
+ *end = p;
+ return mono_class_from_mono_type (t);
+}
+
static void*
load_cattr_value (MonoImage *image, MonoType *t, const char *p, const char **end)
{
type = MONO_TYPE_SZARRAY;
if (etype == 0x50) {
tklass = mono_defaults.systemtype_class;
+ } else if (etype == 0x55) {
+ tklass = load_cattr_enum_type (image, p, &p);
} else {
if (etype == 0x51)
/* See Partition II, Appendix B3 */