X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fcustom-attr.cs;h=79b5fdf4bf38adc3ffd56486286b33e976f4fd5a;hb=601baedfc3e99b308694f67d9945239a2c423e59;hp=7e8d50dd41d7a743a52d2b898e48f0469755f2a0;hpb=0abc2e6270020edc4a5b4c66f93b4ae582815f20;p=mono.git diff --git a/mono/tests/custom-attr.cs b/mono/tests/custom-attr.cs index 7e8d50dd41d..79b5fdf4bf3 100644 --- a/mono/tests/custom-attr.cs +++ b/mono/tests/custom-attr.cs @@ -32,6 +32,20 @@ namespace Test { public char[] Prop2; } + + class XAttribute : Attribute { + public XAttribute () + { + throw new Exception ("X"); + } + } + + class ZAttribute : Attribute { + } + + [X, Z, Serializable] + class Y { + } [My("testclass")] [My2("testclass", 22)] @@ -61,6 +75,24 @@ namespace Test { } } } + + // + // Test that requesting a specific custom attributes does not + // create all the others + // + + typeof (Y).IsDefined (typeof (ZAttribute), true); + typeof (Y).IsDefined (typeof (XAttribute), true); + + typeof (Y).GetCustomAttributes (typeof (ZAttribute), true); + + try { + typeof (Y).GetCustomAttributes (true); + return 4; + } + catch { + } + return 0; } }