Merge pull request #1624 from esdrubal/getprocesstimes
[mono.git] / mcs / class / corlib / System.Reflection.Emit / MethodBuilder.cs
1 //
2 // System.Reflection.Emit/MethodBuilder.cs
3 //
4 // Author:
5 //   Paolo Molaro (lupus@ximian.com)
6 //
7 // (C) 2001 Ximian, Inc.  http://www.ximian.com
8 //
9
10 //
11 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 // 
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 // 
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 //
32
33 #if !FULL_AOT_RUNTIME
34 using System;
35 using System.Reflection;
36 using System.Reflection.Emit;
37 using System.Globalization;
38 using System.Security;
39 using System.Security.Permissions;
40 using System.Runtime.CompilerServices;
41 using System.Runtime.InteropServices;
42 using System.Diagnostics.SymbolStore;
43
44 namespace System.Reflection.Emit
45 {
46         [ComVisible (true)]
47         [ComDefaultInterface (typeof (_MethodBuilder))]
48         [ClassInterface (ClassInterfaceType.None)]
49         [StructLayout (LayoutKind.Sequential)]
50         public sealed class MethodBuilder : MethodInfo, _MethodBuilder
51         {
52 #pragma warning disable 169, 414
53                 private RuntimeMethodHandle mhandle;
54                 private Type rtype;
55                 internal Type[] parameters;
56                 private MethodAttributes attrs; /* It's used directly by MCS */
57                 private MethodImplAttributes iattrs;
58                 private string name;
59                 private int table_idx;
60                 private byte[] code;
61                 private ILGenerator ilgen;
62                 private TypeBuilder type;
63                 internal ParameterBuilder[] pinfo;
64                 private CustomAttributeBuilder[] cattrs;
65                 private MethodInfo[] override_methods;
66                 private string pi_dll;
67                 private string pi_entry;
68                 private CharSet charset;
69                 private uint extra_flags; /* this encodes set_last_error etc */
70                 private CallingConvention native_cc;
71                 private CallingConventions call_conv;
72                 private bool init_locals = true;
73                 private IntPtr generic_container;
74                 internal GenericTypeParameterBuilder[] generic_params;
75                 private Type[] returnModReq;
76                 private Type[] returnModOpt;
77                 private Type[][] paramModReq;
78                 private Type[][] paramModOpt;
79                 private RefEmitPermissionSet[] permissions;
80 #pragma warning restore 169, 414
81
82                 internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnModReq, Type[] returnModOpt, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt)
83                 {
84                         this.name = name;
85                         this.attrs = attributes;
86                         this.call_conv = callingConvention;
87                         this.rtype = returnType;
88                         this.returnModReq = returnModReq;
89                         this.returnModOpt = returnModOpt;
90                         this.paramModReq = paramModReq;
91                         this.paramModOpt = paramModOpt;
92                         // The MSDN docs does not specify this, but the MS MethodBuilder
93                         // appends a HasThis flag if the method is not static
94                         if ((attributes & MethodAttributes.Static) == 0)
95                                 this.call_conv |= CallingConventions.HasThis;
96                         if (parameterTypes != null) {
97                                 for (int i = 0; i < parameterTypes.Length; ++i)
98                                         if (parameterTypes [i] == null)
99                                                 throw new ArgumentException ("Elements of the parameterTypes array cannot be null", "parameterTypes");
100
101                                 this.parameters = new Type [parameterTypes.Length];
102                                 System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
103                         }
104                         type = tb;
105                         table_idx = get_next_table_index (this, 0x06, true);
106
107                         ((ModuleBuilder)tb.Module).RegisterToken (this, GetToken ().Token);
108                 }
109
110                 internal MethodBuilder (TypeBuilder tb, string name, MethodAttributes attributes, 
111                                                                 CallingConventions callingConvention, Type returnType, Type[] returnModReq, Type[] returnModOpt, Type[] parameterTypes, Type[][] paramModReq, Type[][] paramModOpt, 
112                         String dllName, String entryName, CallingConvention nativeCConv, CharSet nativeCharset) 
113                         : this (tb, name, attributes, callingConvention, returnType, returnModReq, returnModOpt, parameterTypes, paramModReq, paramModOpt)
114                 {
115                         pi_dll = dllName;
116                         pi_entry = entryName;
117                         native_cc = nativeCConv;
118                         charset = nativeCharset;
119                 }
120
121                 public override bool ContainsGenericParameters {
122                         get { throw new NotSupportedException (); }
123                 }
124
125                 public bool InitLocals {
126                         get {return init_locals;}
127                         set {init_locals = value;}
128                 }
129
130                 internal TypeBuilder TypeBuilder {
131                         get {return type;}
132                 }
133
134                 public override RuntimeMethodHandle MethodHandle {
135                         get {
136                                 throw NotSupported ();
137                         }
138                 }
139
140                 public override Type ReturnType {
141                         get { return rtype; }
142                 }
143
144                 public override Type ReflectedType {
145                         get { return type; }
146                 }
147
148                 public override Type DeclaringType {
149                         get { return type; }
150                 }
151
152                 public override string Name {
153                         get { return name; }
154                 }
155
156                 public override MethodAttributes Attributes {
157                         get { return attrs; }
158                 }
159
160                 public override ICustomAttributeProvider ReturnTypeCustomAttributes {
161                         get { return null; }
162                 }
163
164                 public override CallingConventions CallingConvention {
165                         get { return call_conv; }
166                 }
167
168                 [MonoTODO("Not implemented")]
169                 public string Signature {
170                         get {
171                                 throw new NotImplementedException ();
172                         }
173                 }
174
175                 /* Used by mcs */
176                 internal bool BestFitMapping {
177                         set {
178                                 extra_flags = (uint) ((extra_flags & ~0x30) | (uint)(value ? 0x10 : 0x20));
179                         }
180                 }
181
182                 /* Used by mcs */
183                 internal bool ThrowOnUnmappableChar {
184                         set {
185                                 extra_flags = (uint) ((extra_flags & ~0x3000) | (uint)(value ? 0x1000 : 0x2000));
186                         }
187                 }
188
189                 /* Used by mcs */
190                 internal bool ExactSpelling {
191                         set {
192                                 extra_flags = (uint) ((extra_flags & ~0x01) | (uint)(value ? 0x01 : 0x00));
193                         }
194                 }
195
196                 /* Used by mcs */
197                 internal bool SetLastError {
198                         set {
199                                 extra_flags = (uint) ((extra_flags & ~0x40) | (uint)(value ? 0x40 : 0x00));
200                         }
201                 }
202
203                 public MethodToken GetToken()
204                 {
205                         return new MethodToken(0x06000000 | table_idx);
206                 }
207                 
208                 public override MethodInfo GetBaseDefinition()
209                 {
210                         return this;
211                 }
212
213                 public override MethodImplAttributes GetMethodImplementationFlags()
214                 {
215                         return iattrs;
216                 }
217
218                 public override ParameterInfo[] GetParameters()
219                 {
220                         if (!type.is_created)
221                                 throw NotSupported ();
222
223                         return GetParametersInternal ();
224                 }
225
226                 internal override ParameterInfo[] GetParametersInternal ()
227                 {
228                         if (parameters == null)
229                                 return null;
230
231                         ParameterInfo[] retval = new ParameterInfo [parameters.Length];
232                         for (int i = 0; i < parameters.Length; i++) {
233                                 retval [i] = ParameterInfo.New (pinfo == null ? null : pinfo [i + 1], parameters [i], this, i + 1);
234                         }
235                         return retval;
236                 }
237                 
238                 internal override int GetParametersCount ()
239                 {
240                         if (parameters == null)
241                                 return 0;
242                         
243                         return parameters.Length;
244                 }
245
246                 internal override Type GetParameterType (int pos) {
247                         return parameters [pos];
248                 }
249
250                 public Module GetModule ()
251                 {
252                         return type.Module;
253                 }
254
255                 public void CreateMethodBody (byte[] il, int count)
256                 {
257                         if ((il != null) && ((count < 0) || (count > il.Length)))
258                                 throw new ArgumentOutOfRangeException ("Index was out of range.  Must be non-negative and less than the size of the collection.");
259
260                         if ((code != null) || type.is_created)
261                                 throw new InvalidOperationException ("Type definition of the method is complete.");
262
263                         if (il == null)
264                                 code = null;
265                         else {
266                                 code = new byte [count];
267                                 System.Array.Copy(il, code, count);
268                         }
269                 }
270
271                 public override Object Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
272                 {
273                         throw NotSupported ();
274                 }
275
276                 public override bool IsDefined (Type attributeType, bool inherit)
277                 {
278                         throw NotSupported ();
279                 }
280
281                 public override object[] GetCustomAttributes (bool inherit)
282                 {
283                         /*
284                          * On MS.NET, this always returns not_supported, but we can't do this
285                          * since there would be no way to obtain custom attributes of 
286                          * dynamically created ctors.
287                          */
288                         if (type.is_created)
289                                 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
290                         else
291                                 throw NotSupported ();
292                 }
293
294                 public override object[] GetCustomAttributes (Type attributeType, bool inherit)
295                 {
296                         if (type.is_created)
297                                 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
298                         else
299                                 throw NotSupported ();
300                 }
301
302                 public ILGenerator GetILGenerator ()
303                 {
304                         return GetILGenerator (64);
305                 }
306
307                 public ILGenerator GetILGenerator (int size)
308                 {
309                         if (((iattrs & MethodImplAttributes.CodeTypeMask) != 
310                                  MethodImplAttributes.IL) ||
311                                 ((iattrs & MethodImplAttributes.ManagedMask) != 
312                                  MethodImplAttributes.Managed))
313                                 throw new InvalidOperationException ("Method body should not exist.");
314                         if (ilgen != null)
315                                 return ilgen;
316                         ilgen = new ILGenerator (type.Module, ((ModuleBuilder)type.Module).GetTokenGenerator (), size);
317                         return ilgen;
318                 }
319                 
320                 public ParameterBuilder DefineParameter (int position, ParameterAttributes attributes, string strParamName)
321                 {
322                         RejectIfCreated ();
323                         
324                         //
325                         // Extension: Mono allows position == 0 for the return attribute
326                         //
327                         if ((position < 0) || (position > parameters.Length))
328                                 throw new ArgumentOutOfRangeException ("position");
329
330                         ParameterBuilder pb = new ParameterBuilder (this, position, attributes, strParamName);
331                         if (pinfo == null)
332                                 pinfo = new ParameterBuilder [parameters.Length + 1];
333                         pinfo [position] = pb;
334                         return pb;
335                 }
336
337                 internal void check_override ()
338                 {
339                         if (override_methods != null) {
340                                 foreach (var m in override_methods) {
341                                         if (m.IsVirtual && !IsVirtual)
342                                                 throw new TypeLoadException (String.Format("Method '{0}' override '{1}' but it is not virtual", name, m));
343                                 }
344                         }
345                 }
346
347                 internal void fixup ()
348                 {
349                         if (((attrs & (MethodAttributes.Abstract | MethodAttributes.PinvokeImpl)) == 0) && ((iattrs & (MethodImplAttributes.Runtime | MethodImplAttributes.InternalCall)) == 0)) {
350                                 // do not allow zero length method body on MS.NET 2.0 (and higher)
351                                 if (((ilgen == null) || (ilgen.ILOffset == 0)) && (code == null || code.Length == 0))
352                                         throw new InvalidOperationException (
353                                                                              String.Format ("Method '{0}.{1}' does not have a method body.",
354                                                                                             DeclaringType.FullName, Name));
355                         }
356                         if (ilgen != null)
357                                 ilgen.label_fixup (this);
358                 }
359                 
360                 internal void GenerateDebugInfo (ISymbolWriter symbolWriter)
361                 {
362                         if (ilgen != null && ilgen.HasDebugInfo) {
363                                 SymbolToken token = new SymbolToken (GetToken().Token);
364                                 symbolWriter.OpenMethod (token);
365                                 symbolWriter.SetSymAttribute (token, "__name", System.Text.Encoding.UTF8.GetBytes (Name));
366                                 ilgen.GenerateDebugInfo (symbolWriter);
367                                 symbolWriter.CloseMethod ();
368                         }
369                 }
370
371                 public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
372                 {
373                         if (customBuilder == null)
374                                 throw new ArgumentNullException ("customBuilder");
375
376                         switch (customBuilder.Ctor.ReflectedType.FullName) {
377                                 case "System.Runtime.CompilerServices.MethodImplAttribute":
378                                         byte[] data = customBuilder.Data;
379                                         int impla; // the (stupid) ctor takes a short or an int ... 
380                                         impla = (int)data [2];
381                                         impla |= ((int)data [3]) << 8;
382                                         iattrs |= (MethodImplAttributes)impla;
383                                         return;
384
385                                 case "System.Runtime.InteropServices.DllImportAttribute":
386                                         CustomAttributeBuilder.CustomAttributeInfo attr = CustomAttributeBuilder.decode_cattr (customBuilder);
387                                         bool preserveSig = true;
388
389                                         /*
390                                          * It would be easier to construct a DllImportAttribute from
391                                          * the custom attribute builder, but the DllImportAttribute 
392                                          * does not contain all the information required here, ie.
393                                          * - some parameters, like BestFitMapping has three values
394                                          *   ("on", "off", "missing"), but DllImportAttribute only
395                                          *   contains two (on/off).
396                                          * - PreserveSig is true by default, while it is false by
397                                          *   default in DllImportAttribute.
398                                          */
399
400                                         pi_dll = (string)attr.ctorArgs[0];
401                                         if (pi_dll == null || pi_dll.Length == 0)
402                                                 throw new ArgumentException ("DllName cannot be empty");
403
404                                         native_cc = System.Runtime.InteropServices.CallingConvention.Winapi;
405
406                                         for (int i = 0; i < attr.namedParamNames.Length; ++i) {
407                                                 string name = attr.namedParamNames [i];
408                                                 object value = attr.namedParamValues [i];
409
410                                                 if (name == "CallingConvention")
411                                                         native_cc = (CallingConvention)value;
412                                                 else if (name == "CharSet")
413                                                         charset = (CharSet)value;
414                                                 else if (name == "EntryPoint")
415                                                         pi_entry = (string)value;
416                                                 else if (name == "ExactSpelling")
417                                                         ExactSpelling = (bool)value;
418                                                 else if (name == "SetLastError")
419                                                         SetLastError = (bool)value;
420                                                 else if (name == "PreserveSig")
421                                                         preserveSig = (bool)value;
422                                         else if (name == "BestFitMapping")
423                                                 BestFitMapping = (bool)value;
424                                         else if (name == "ThrowOnUnmappableChar")
425                                                 ThrowOnUnmappableChar = (bool)value;
426                                         }
427
428                                         attrs |= MethodAttributes.PinvokeImpl;
429                                         if (preserveSig)
430                                                 iattrs |= MethodImplAttributes.PreserveSig;
431                                         return;
432
433                                 case "System.Runtime.InteropServices.PreserveSigAttribute":
434                                         iattrs |= MethodImplAttributes.PreserveSig;
435                                         return;
436                                 case "System.Runtime.CompilerServices.SpecialNameAttribute":
437                                         attrs |= MethodAttributes.SpecialName;
438                                         return;
439                                 case "System.Security.SuppressUnmanagedCodeSecurityAttribute":
440                                         attrs |= MethodAttributes.HasSecurity;
441                                         break;
442                         }
443
444                         if (cattrs != null) {
445                                 CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
446                                 cattrs.CopyTo (new_array, 0);
447                                 new_array [cattrs.Length] = customBuilder;
448                                 cattrs = new_array;
449                         } else {
450                                 cattrs = new CustomAttributeBuilder [1];
451                                 cattrs [0] = customBuilder;
452                         }
453                 }
454
455                 [ComVisible (true)]
456                 public void SetCustomAttribute (ConstructorInfo con, byte[] binaryAttribute)
457                 {
458                         if (con == null)
459                                 throw new ArgumentNullException ("con");
460                         if (binaryAttribute == null)
461                                 throw new ArgumentNullException ("binaryAttribute");
462                         SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
463                 }
464
465                 public void SetImplementationFlags (MethodImplAttributes attributes)
466                 {
467                         RejectIfCreated ();
468                         iattrs = attributes;
469                 }
470
471                 public void AddDeclarativeSecurity (SecurityAction action, PermissionSet pset)
472                 {
473 #if !NET_2_1
474                         if (pset == null)
475                                 throw new ArgumentNullException ("pset");
476                         if ((action == SecurityAction.RequestMinimum) ||
477                                 (action == SecurityAction.RequestOptional) ||
478                                 (action == SecurityAction.RequestRefuse))
479                                 throw new ArgumentOutOfRangeException ("Request* values are not permitted", "action");
480
481                         RejectIfCreated ();
482
483                         if (permissions != null) {
484                                 /* Check duplicate actions */
485                                 foreach (RefEmitPermissionSet set in permissions)
486                                         if (set.action == action)
487                                                 throw new InvalidOperationException ("Multiple permission sets specified with the same SecurityAction.");
488
489                                 RefEmitPermissionSet[] new_array = new RefEmitPermissionSet [permissions.Length + 1];
490                                 permissions.CopyTo (new_array, 0);
491                                 permissions = new_array;
492                         }
493                         else
494                                 permissions = new RefEmitPermissionSet [1];
495
496                         permissions [permissions.Length - 1] = new RefEmitPermissionSet (action, pset.ToXml ().ToString ());
497                         attrs |= MethodAttributes.HasSecurity;
498 #endif
499                 }
500
501                 [Obsolete ("An alternate API is available: Emit the MarshalAs custom attribute instead.")]
502                 public void SetMarshal (UnmanagedMarshal unmanagedMarshal)
503                 {
504                         RejectIfCreated ();
505                         throw new NotImplementedException ();
506                 }
507
508                 [MonoTODO]
509                 public void SetSymCustomAttribute (string name, byte[] data)
510                 {
511                         RejectIfCreated ();
512                         throw new NotImplementedException ();
513                 }
514
515                 public override string ToString()
516                 {
517                         return "MethodBuilder [" + type.Name + "::" + name + "]";
518                 }
519
520                 [MonoTODO]
521                 public override bool Equals (object obj)
522                 {
523                         return base.Equals (obj);
524                 }
525
526                 public override int GetHashCode ()
527                 {
528                         return name.GetHashCode ();
529                 }
530
531                 internal override int get_next_table_index (object obj, int table, bool inc)
532                 {
533                         return type.get_next_table_index (obj, table, inc);
534                 }
535
536                 void ExtendArray<T> (ref T[] array, T elem) {
537                         if (array == null) {
538                                 array = new T [1];
539                         } else {
540                                 var newa = new T [array.Length + 1];
541                                 Array.Copy (array, newa, array.Length);
542                                 array = newa;
543                         }
544                         array [array.Length - 1] = elem;
545                 }
546
547                 internal void set_override (MethodInfo mdecl)
548                 {
549                         ExtendArray<MethodInfo> (ref override_methods, mdecl);
550                 }
551
552                 private void RejectIfCreated ()
553                 {
554                         if (type.is_created)
555                                 throw new InvalidOperationException ("Type definition of the method is complete.");
556                 }
557
558                 private Exception NotSupported ()
559                 {
560                         return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
561                 }
562
563                 public override MethodInfo MakeGenericMethod (params Type [] typeArguments)
564                 {
565                         if (!IsGenericMethodDefinition)
566                                 throw new InvalidOperationException ("Method is not a generic method definition");
567                         if (typeArguments == null)
568                                 throw new ArgumentNullException ("typeArguments");
569                         if (generic_params.Length != typeArguments.Length)
570                                 throw new ArgumentException ("Incorrect length", "typeArguments");
571                         foreach (Type type in typeArguments) {
572                                 if (type == null)
573                                         throw new ArgumentNullException ("typeArguments");
574                         }
575
576                         return new MethodOnTypeBuilderInst (this, typeArguments);
577                 }
578
579                 public override bool IsGenericMethodDefinition {
580                         get {
581                                 return generic_params != null;
582                         }
583                 }
584
585                 public override bool IsGenericMethod {
586                         get {
587                                 return generic_params != null;
588                         }
589                 }
590
591                 public override MethodInfo GetGenericMethodDefinition ()
592                 {
593                         if (!IsGenericMethodDefinition)
594                                 throw new InvalidOperationException ();
595
596                         return this;
597                 }
598
599                 public override Type[] GetGenericArguments ()
600                 {
601                         if (generic_params == null)
602                                 return null;
603
604                         Type[] result = new Type [generic_params.Length];
605                         for (int i = 0; i < generic_params.Length; i++)
606                                 result [i] = generic_params [i];
607
608                         return result;
609                 }
610
611                 public GenericTypeParameterBuilder[] DefineGenericParameters (params string[] names)
612                 {
613                         if (names == null)
614                                 throw new ArgumentNullException ("names");
615                         if (names.Length == 0)
616                                 throw new ArgumentException ("names");
617
618                         generic_params = new GenericTypeParameterBuilder [names.Length];
619                         for (int i = 0; i < names.Length; i++) {
620                                 string item = names [i];
621                                 if (item == null)
622                                         throw new ArgumentNullException ("names");
623                                 generic_params [i] = new GenericTypeParameterBuilder (type, this, item, i);
624                         }
625
626                         return generic_params;
627                 }
628
629                 public void SetReturnType (Type returnType)
630                 {
631                         rtype = returnType;
632                 }
633
634                 public void SetParameters (params Type[] parameterTypes)
635                 {
636                         if (parameterTypes != null) {
637                                 for (int i = 0; i < parameterTypes.Length; ++i)
638                                         if (parameterTypes [i] == null)
639                                                 throw new ArgumentException ("Elements of the parameterTypes array cannot be null", "parameterTypes");
640
641                                 this.parameters = new Type [parameterTypes.Length];
642                                 System.Array.Copy (parameterTypes, this.parameters, parameterTypes.Length);
643                         }
644                 }
645
646                 public void SetSignature (Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
647                 {
648                         SetReturnType (returnType);
649                         SetParameters (parameterTypes);
650                         this.returnModReq = returnTypeRequiredCustomModifiers;
651                         this.returnModOpt = returnTypeOptionalCustomModifiers;
652                         this.paramModReq = parameterTypeRequiredCustomModifiers;
653                         this.paramModOpt = parameterTypeOptionalCustomModifiers;
654                 }
655
656                 public override Module Module {
657                         get {
658                                 return GetModule ();
659                         }
660                 }
661
662                 void _MethodBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
663                 {
664                         throw new NotImplementedException ();
665                 }
666
667                 void _MethodBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
668                 {
669                         throw new NotImplementedException ();
670                 }
671
672                 void _MethodBuilder.GetTypeInfoCount (out uint pcTInfo)
673                 {
674                         throw new NotImplementedException ();
675                 }
676
677                 void _MethodBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
678                 {
679                         throw new NotImplementedException ();
680                 }
681
682                 public override ParameterInfo ReturnParameter {
683                         get { return base.ReturnParameter; }
684                 }
685         }
686 }
687 #endif