Avoid random failure in CountdownEvent unit test
[mono.git] / mcs / class / corlib / System.Reflection.Emit / EventBuilder.cs
old mode 100755 (executable)
new mode 100644 (file)
index 8adb6ad..3738bf9
@@ -39,17 +39,22 @@ using System.Runtime.CompilerServices;
 using System.Runtime.InteropServices;
 
 namespace System.Reflection.Emit {
-       public sealed class EventBuilder {
-               string name;
+       [ComVisible (true)]
+       [ComDefaultInterface (typeof (_EventBuilder))]
+       [ClassInterface (ClassInterfaceType.None)]
+       public sealed class EventBuilder : _EventBuilder {
+#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;
@@ -103,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);
@@ -113,6 +123,8 @@ namespace System.Reflection.Emit {
                                cattrs [0] = customBuilder;
                        }
                }
+
+               [ComVisible (true)]
                public void SetCustomAttribute( ConstructorInfo con, byte[] binaryAttribute) {
                        if (con == null)
                                throw new ArgumentNullException ("con");
@@ -125,6 +137,26 @@ namespace System.Reflection.Emit {
                        if (typeb.is_created)
                                throw new InvalidOperationException ("Type definition of the method is complete.");
                }
+
+               void _EventBuilder.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _EventBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _EventBuilder.GetTypeInfoCount (out uint pcTInfo)
+               {
+                       throw new NotImplementedException ();
+               }
+
+               void _EventBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
+               {
+                       throw new NotImplementedException ();
+               }
        }
 }