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