[tuner] handle the case with multiple "preserve" attributes
[mono-project.git] / mcs / tests / test-492.cs
blobaea7430097c2dc2d1354ea01845d842ac0b14686
1 using System;
2 using System.Reflection;
4 namespace Test {
5 [AttributeUsage (AttributeTargets.All, AllowMultiple = true)]
6 public class My1Attribute : Attribute
8 public My1Attribute (object o)
10 if (o != null)
11 throw new ApplicationException ();
15 public class My2Attribute : Attribute
17 public My2Attribute (string[] s)
19 if (s.Length != 0)
20 throw new ApplicationException ();
24 public class My3Attribute : Attribute
26 public My3Attribute (byte b)
28 if (b != 0xFF)
29 throw new ApplicationException ();
34 [My3(unchecked((byte)-1))]
35 [My1((object)null)]
36 [My1(null)]
37 [My2(new string[0])]
38 public class Test {
39 public static int Main() {
40 System.Reflection.MemberInfo info = typeof (Test);
41 object[] attributes = info.GetCustomAttributes (false);
43 if (attributes.Length != 4)
44 return 1;
46 for (int i = 0; i < attributes.Length; i ++) {
47 Console.WriteLine (attributes [i]);
50 return 0;