Avoid random failure in CountdownEvent unit test
[mono.git] / mcs / class / corlib / System.Reflection.Emit / EventBuilder.cs
index 8f5493b651ae7167452db0155f2e211a74bc8f47..3738bf97243c5e8032ae128377586a1315566710 100644 (file)
@@ -39,22 +39,22 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
-#if NET_2_0
        [ComVisible (true)]
        [ComDefaultInterface (typeof (_EventBuilder))]
-#endif
        [ClassInterface (ClassInterfaceType.None)]
        public sealed class EventBuilder : _EventBuilder {
-               string name;
+#pragma warning disable 169, 414
+               internal string name;
                Type type;
                TypeBuilder typeb;
                CustomAttributeBuilder[] cattrs;
-               MethodBuilder add_method;
-               MethodBuilder remove_method;
-               MethodBuilder raise_method;
-               MethodBuilder[] other_methods;
-               EventAttributes attrs;
+               internal MethodBuilder add_method;
+               internal MethodBuilder remove_method;
+               internal MethodBuilder raise_method;
+               internal MethodBuilder[] other_methods;
+               internal EventAttributes attrs;
                int table_idx;
+#pragma warning restore 169, 414
 
                internal EventBuilder (TypeBuilder tb, string eventName, EventAttributes eventAttrs, Type eventType) {
                        name = eventName;
@@ -108,6 +108,11 @@ namespace System.Reflection.Emit {
                        if (customBuilder == null)
                                throw new ArgumentNullException ("customBuilder");
                        RejectIfCreated ();
+                       string attrname = customBuilder.Ctor.ReflectedType.FullName;
+                       if (attrname == "System.Runtime.CompilerServices.SpecialNameAttribute") {
+                               attrs |= EventAttributes.SpecialName;
+                               return;
+                       }
                        if (cattrs != null) {
                                CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
                                cattrs.CopyTo (new_array, 0);
@@ -119,9 +124,7 @@ namespace System.Reflection.Emit {
                        }
                }
 
-#if NET_2_0
                [ComVisible (true)]
-#endif
                public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
                        if (con == null)
                                throw new ArgumentNullException ("con");