Remove no longer used BOOTSTRAP conditionals
[mono.git] / mcs / class / corlib / System.Reflection.Emit / AssemblyBuilder.cs
1 //
2 // System.Reflection.Emit/AssemblyBuilder.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.Resources;
36 using System.IO;
37 using System.Security.Policy;
38 using System.Runtime.Serialization;
39 using System.Globalization;
40 using System.Runtime.CompilerServices;
41 using System.Collections;
42 using System.Collections.Generic;
43 using System.Runtime.InteropServices;
44 using System.Security;
45 using System.Security.Cryptography;
46 using System.Security.Permissions;
47
48 using Mono.Security;
49 using Mono.Security.Cryptography;
50
51 namespace System.Reflection.Emit
52 {
53         internal enum NativeResourceType
54         {
55                 None,
56                 Unmanaged,
57                 Assembly,
58                 Explicit
59         }
60
61         internal struct RefEmitPermissionSet {
62                 public SecurityAction action;
63                 public string pset;
64
65                 public RefEmitPermissionSet (SecurityAction action, string pset) {
66                         this.action = action;
67                         this.pset = pset;
68                 }
69         }
70
71         internal struct MonoResource {
72                 public byte[] data;
73                 public string name;
74                 public string filename;
75                 public ResourceAttributes attrs;
76                 public int offset;
77                 public Stream stream;
78         }
79
80         internal struct MonoWin32Resource {
81                 public int res_type;
82                 public int res_id;
83                 public int lang_id;
84                 public byte[] data;
85
86                 public MonoWin32Resource (int res_type, int res_id, int lang_id, byte[] data) {
87                         this.res_type = res_type;
88                         this.res_id = res_id;
89                         this.lang_id = lang_id;
90                         this.data = data;
91                 }
92         }
93
94         internal class GenericInstanceKey {
95                 Type gtd;
96                 internal Type[] args;
97                 int hash_code;
98
99                 internal GenericInstanceKey (Type gtd, Type[] args)
100                 {
101                         this.gtd = gtd;
102                         this.args = args;
103
104                         hash_code = gtd.GetHashCode ();
105                         for (int i = 0; i < args.Length; ++i)
106                                 hash_code ^= args [i].GetHashCode ();
107                 }
108
109                 static bool IsBoundedVector (Type type) {
110                         ArrayType at = type as ArrayType;
111                         if (at != null)
112                                 return at.GetEffectiveRank () == 1;
113                         return type.ToString ().EndsWith ("[*]", StringComparison.Ordinal); /*Super uggly hack, SR doesn't allow one to query for it */
114                 }
115
116                 static bool TypeEquals (Type a, Type b) {
117                         if (a == b)
118                                 return true;
119
120                         if (a.HasElementType) {
121                                 if (!b.HasElementType)
122                                         return false;
123                                 if (!TypeEquals (a.GetElementType (), b.GetElementType ()))
124                                         return false;
125                                 if (a.IsArray) {
126                                         if (!b.IsArray)
127                                                 return false;
128                                         int rank = a.GetArrayRank ();
129                                         if (rank != b.GetArrayRank ())
130                                                 return false;
131                                         if (rank == 1 && IsBoundedVector (a) != IsBoundedVector (b))
132                                                 return false;
133                                 } else if (a.IsByRef) {
134                                         if (!b.IsByRef)
135                                                 return false;
136                                 } else if (a.IsPointer) {
137                                         if (!b.IsPointer)
138                                                 return false;
139                                 }
140                                 return true;
141                         }
142
143                         if (a.IsGenericType) {
144                                 if (!b.IsGenericType)
145                                         return false;
146                                 if (a.IsGenericParameter)
147                                         return a == b;
148                                 if (a.IsGenericParameter) //previous test should have caught it
149                                         return false;
150
151                                 if (a.IsGenericTypeDefinition) {
152                                         if (!b.IsGenericTypeDefinition)
153                                                 return false;
154                                 } else {
155                                         if (b.IsGenericTypeDefinition)
156                                                 return false;
157                                         if (!TypeEquals (a.GetGenericTypeDefinition (), b.GetGenericTypeDefinition ()))
158                                                 return false;
159
160                                         Type[] argsA = a.GetGenericArguments ();
161                                         Type[] argsB = b.GetGenericArguments ();
162                                         for (int i = 0; i < argsA.Length; ++i) {
163                                                 if (!TypeEquals (argsA [i], argsB [i]))
164                                                         return false;
165                                         }
166                                 }
167                         }
168
169                         /*
170                         Now only non-generic, non compound types are left. To properly deal with user
171                         types we would have to call UnderlyingSystemType, but we let them have their
172                         own instantiation as this is MS behavior and mcs (pre C# 4.0, at least) doesn't
173                         depend on proper UT canonicalization.
174                         */
175                         return a == b;
176                 }
177
178                 public override bool Equals (object obj)
179                 {
180                         GenericInstanceKey other = obj as GenericInstanceKey;
181                         if (other == null)
182                                 return false;
183                         if (gtd != other.gtd)
184                                 return false;
185                         for (int i = 0; i < args.Length; ++i) {
186                                 Type a = args [i];
187                                 Type b = other.args [i];
188                                 /*
189                                 We must cannonicalize as much as we can. Using equals means that some resulting types
190                                 won't have the exact same types as the argument ones. 
191                                 For example, flyweight types used array, pointer and byref will should this behavior.
192                                 MCS seens to be resilient to this problem so hopefully this won't show up.   
193                                 */
194                                 if (a != b && !a.Equals (b))
195                                         return false;
196                         }
197                         return true;
198                 }
199
200                 public override int GetHashCode ()
201                 {
202                         return hash_code;
203                 }
204         }
205
206
207         [ComVisible (true)]
208         [ComDefaultInterface (typeof (_AssemblyBuilder))]
209         [ClassInterface (ClassInterfaceType.None)]
210         public sealed class AssemblyBuilder : Assembly, _AssemblyBuilder {
211 #pragma warning disable 169, 414
212                 #region Sync with object-internals.h
213                 private UIntPtr dynamic_assembly; /* GC-tracked */
214                 private MethodInfo entry_point;
215                 private ModuleBuilder[] modules;
216                 private string name;
217                 private string dir;
218                 private CustomAttributeBuilder[] cattrs;
219                 private MonoResource[] resources;
220                 byte[] public_key;
221                 string version;
222                 string culture;
223                 uint algid;
224                 uint flags;
225                 PEFileKinds pekind = PEFileKinds.Dll;
226                 bool delay_sign;
227                 uint access;
228                 Module[] loaded_modules;
229                 MonoWin32Resource[] win32_resources;
230                 private RefEmitPermissionSet[] permissions_minimum;
231                 private RefEmitPermissionSet[] permissions_optional;
232                 private RefEmitPermissionSet[] permissions_refused;
233                 PortableExecutableKinds peKind;
234                 ImageFileMachine machine;
235                 bool corlib_internal;
236                 Type[] type_forwarders;
237                 byte[] pktoken;
238                 #endregion
239 #pragma warning restore 169, 414
240                 
241                 internal Type corlib_object_type = typeof (System.Object);
242                 internal Type corlib_value_type = typeof (System.ValueType);
243                 internal Type corlib_enum_type = typeof (System.Enum);
244                 internal Type corlib_void_type = typeof (void);
245                 ArrayList resource_writers = null;
246                 Win32VersionResource version_res;
247                 bool created;
248                 bool is_module_only;
249                 private Mono.Security.StrongName sn;
250                 NativeResourceType native_resource;
251                 readonly bool is_compiler_context;
252                 string versioninfo_culture;
253                 Hashtable generic_instances = new Hashtable ();
254
255                 [MethodImplAttribute(MethodImplOptions.InternalCall)]
256                 private static extern void basic_init (AssemblyBuilder ab);
257
258                 /* Keep this in sync with codegen.cs in mcs */
259                 private const AssemblyBuilderAccess COMPILER_ACCESS = (AssemblyBuilderAccess) 0x800;
260
261                 internal AssemblyBuilder (AssemblyName n, string directory, AssemblyBuilderAccess access, bool corlib_internal)
262                 {
263                         is_compiler_context = (access & COMPILER_ACCESS) != 0;
264
265                         // remove Mono specific flag to allow enum check to pass
266                         access &= ~COMPILER_ACCESS;
267
268 #if MOONLIGHT
269                         // only "Run" is supported by Silverlight
270                         // however SMCS requires more than this but runs outside the CoreCLR sandbox
271                         if (SecurityManager.SecurityEnabled && (access != AssemblyBuilderAccess.Run))
272                                 throw new ArgumentException ("access");
273 #endif
274
275                         if (!Enum.IsDefined (typeof (AssemblyBuilderAccess), access))
276                                 throw new ArgumentException (string.Format (CultureInfo.InvariantCulture,
277                                         "Argument value {0} is not valid.", (int) access),
278                                         "access");
279
280 #if NET_4_0
281                         if ((access & AssemblyBuilderAccess.RunAndCollect) == AssemblyBuilderAccess.RunAndCollect)
282                                 throw new NotSupportedException ("RunAndCollect not yet supported.");
283 #endif
284
285                         name = n.Name;
286                         this.access = (uint)access;
287                         flags = (uint) n.Flags;
288
289                         // don't call GetCurrentDirectory for Run-only builders (CAS may not like that)
290                         if (IsSave && (directory == null || directory.Length == 0)) {
291                                 dir = Directory.GetCurrentDirectory ();
292                         } else {
293                                 dir = directory;
294                         }
295
296                         /* Set defaults from n */
297                         if (n.CultureInfo != null) {
298                                 culture = n.CultureInfo.Name;
299                                 versioninfo_culture = n.CultureInfo.Name;
300                         }
301                         Version v = n.Version;
302                         if (v != null) {
303                                 version = v.ToString ();
304                         }
305
306                         if (n.KeyPair != null) {
307                                 // full keypair is available (for signing)
308                                 sn = n.KeyPair.StrongName ();
309                         } else {
310                                 // public key is available (for delay-signing)
311                                 byte[] pk = n.GetPublicKey ();
312                                 if ((pk != null) && (pk.Length > 0)) {
313                                         sn = new Mono.Security.StrongName (pk);
314                                 }
315                         }
316
317                         if (sn != null)
318                                 flags |= (uint) AssemblyNameFlags.PublicKey;
319
320                         this.corlib_internal = corlib_internal;
321                         if (sn != null) {
322                                 this.pktoken = new byte[sn.PublicKeyToken.Length * 2];
323                                 int pkti = 0;
324                                 foreach (byte pkb in sn.PublicKeyToken) {
325                                         string part = pkb.ToString("x2");
326                                         this.pktoken[pkti++] = (byte)part[0];
327                                         this.pktoken[pkti++] = (byte)part[1];
328                                 }
329                         }
330
331                         basic_init (this);
332                 }
333
334                 public override string CodeBase {
335                         get {
336                                 throw not_supported ();
337                         }
338                 }
339                 
340                 public override MethodInfo EntryPoint {
341                         get {
342                                 return entry_point;
343                         }
344                 }
345
346                 public override string Location {
347                         get {
348                                 throw not_supported ();
349                         }
350                 }
351
352                 /* This is to keep signature compatibility with MS.NET */
353                 public override string ImageRuntimeVersion {
354                         get {
355                                 return base.ImageRuntimeVersion;
356                         }
357                 }
358
359                 [MonoTODO]
360                 public override bool ReflectionOnly {
361                         get { return base.ReflectionOnly; }
362                 }
363
364                 public void AddResourceFile (string name, string fileName)
365                 {
366                         AddResourceFile (name, fileName, ResourceAttributes.Public);
367                 }
368
369                 public void AddResourceFile (string name, string fileName, ResourceAttributes attribute)
370                 {
371                         AddResourceFile (name, fileName, attribute, true);
372                 }
373
374                 private void AddResourceFile (string name, string fileName, ResourceAttributes attribute, bool fileNeedsToExists)
375                 {
376                         check_name_and_filename (name, fileName, fileNeedsToExists);
377
378                         // Resource files are created/searched under the assembly storage
379                         // directory
380                         if (dir != null)
381                                 fileName = Path.Combine (dir, fileName);
382
383                         if (resources != null) {
384                                 MonoResource[] new_r = new MonoResource [resources.Length + 1];
385                                 System.Array.Copy(resources, new_r, resources.Length);
386                                 resources = new_r;
387                         } else {
388                                 resources = new MonoResource [1];
389                         }
390                         int p = resources.Length - 1;
391                         resources [p].name = name;
392                         resources [p].filename = fileName;
393                         resources [p].attrs = attribute;
394                 }
395
396                 /// <summary>
397                 /// Don't change the method name and parameters order. It is used by mcs 
398                 /// </summary>
399                 internal void AddPermissionRequests (PermissionSet required, PermissionSet optional, PermissionSet refused)
400                 {
401 #if !NET_2_1
402                         if (created)
403                                 throw new InvalidOperationException ("Assembly was already saved.");
404
405                         // required for base Assembly class (so the permissions
406                         // can be used even if the assembly isn't saved to disk)
407                         _minimum = required;
408                         _optional = optional;
409                         _refuse = refused;
410
411                         // required to reuse AddDeclarativeSecurity support 
412                         // already present in the runtime
413                         if (required != null) {
414                                 permissions_minimum = new RefEmitPermissionSet [1];
415                                 permissions_minimum [0] = new RefEmitPermissionSet (
416                                         SecurityAction.RequestMinimum, required.ToXml ().ToString ());
417                         }
418                         if (optional != null) {
419                                 permissions_optional = new RefEmitPermissionSet [1];
420                                 permissions_optional [0] = new RefEmitPermissionSet (
421                                         SecurityAction.RequestOptional, optional.ToXml ().ToString ());
422                         }
423                         if (refused != null) {
424                                 permissions_refused = new RefEmitPermissionSet [1];
425                                 permissions_refused [0] = new RefEmitPermissionSet (
426                                         SecurityAction.RequestRefuse, refused.ToXml ().ToString ());
427                         }
428 #endif
429                 }
430
431                 // Still in use by al.exe
432                 internal void EmbedResourceFile (string name, string fileName)
433                 {
434                         EmbedResourceFile (name, fileName, ResourceAttributes.Public);
435                 }
436
437                 void EmbedResourceFile (string name, string fileName, ResourceAttributes attribute)
438                 {
439                         if (resources != null) {
440                                 MonoResource[] new_r = new MonoResource [resources.Length + 1];
441                                 System.Array.Copy(resources, new_r, resources.Length);
442                                 resources = new_r;
443                         } else {
444                                 resources = new MonoResource [1];
445                         }
446                         int p = resources.Length - 1;
447                         resources [p].name = name;
448                         resources [p].attrs = attribute;
449                         try {
450                                 FileStream s = new FileStream (fileName, FileMode.Open, FileAccess.Read);
451                                 long len = s.Length;
452                                 resources [p].data = new byte [len];
453                                 s.Read (resources [p].data, 0, (int)len);
454                                 s.Close ();
455                         } catch {
456                         }
457                 }
458 /*
459                 internal void EmbedResource (string name, byte[] blob, ResourceAttributes attribute)
460                 {
461                         if (resources != null) {
462                                 MonoResource[] new_r = new MonoResource [resources.Length + 1];
463                                 System.Array.Copy(resources, new_r, resources.Length);
464                                 resources = new_r;
465                         } else {
466                                 resources = new MonoResource [1];
467                         }
468                         int p = resources.Length - 1;
469                         resources [p].name = name;
470                         resources [p].attrs = attribute;
471                         resources [p].data = blob;
472                 }
473 */
474                 internal void AddTypeForwarder (Type t) {
475                         if (t == null)
476                                 throw new ArgumentNullException ("t");
477                         if (t.IsNested)
478                                 throw new ArgumentException ();
479
480                         if (type_forwarders == null) {
481                                 type_forwarders = new Type [1] { t };
482                         } else {
483                                 Type[] arr = new Type [type_forwarders.Length + 1];
484                                 Array.Copy (type_forwarders, arr, type_forwarders.Length);
485                                 arr [type_forwarders.Length] = t;
486                                 type_forwarders = arr;
487                         }
488                 }
489
490                 public ModuleBuilder DefineDynamicModule (string name)
491                 {
492                         return DefineDynamicModule (name, name, false, true);
493                 }
494
495                 public ModuleBuilder DefineDynamicModule (string name, bool emitSymbolInfo)
496                 {
497                         return DefineDynamicModule (name, name, emitSymbolInfo, true);
498                 }
499
500                 public ModuleBuilder DefineDynamicModule(string name, string fileName)
501                 {
502                         return DefineDynamicModule (name, fileName, false, false);
503                 }
504
505                 public ModuleBuilder DefineDynamicModule (string name, string fileName,
506                                                           bool emitSymbolInfo)
507                 {
508                         return DefineDynamicModule (name, fileName, emitSymbolInfo, false);
509                 }
510
511                 private ModuleBuilder DefineDynamicModule (string name, string fileName, bool emitSymbolInfo, bool transient)
512                 {
513                         check_name_and_filename (name, fileName, false);
514
515                         if (!transient) {
516                                 if (Path.GetExtension (fileName) == String.Empty)
517                                         throw new ArgumentException ("Module file name '" + fileName + "' must have file extension.");
518                                 if (!IsSave)
519                                         throw new NotSupportedException ("Persistable modules are not supported in a dynamic assembly created with AssemblyBuilderAccess.Run");
520                                 if (created)
521                                         throw new InvalidOperationException ("Assembly was already saved.");
522                         }
523
524                         ModuleBuilder r = new ModuleBuilder (this, name, fileName, emitSymbolInfo, transient);
525
526                         if ((modules != null) && is_module_only)
527                                 throw new InvalidOperationException ("A module-only assembly can only contain one module.");
528
529                         if (modules != null) {
530                                 ModuleBuilder[] new_modules = new ModuleBuilder [modules.Length + 1];
531                                 System.Array.Copy(modules, new_modules, modules.Length);
532                                 modules = new_modules;
533                         } else {
534                                 modules = new ModuleBuilder [1];
535                         }
536                         modules [modules.Length - 1] = r;
537                         return r;
538                 }
539
540                 [MethodImplAttribute(MethodImplOptions.InternalCall)]
541                 private extern Module InternalAddModule (string fileName);
542
543                 /*
544                  * Mono extension to support /addmodule in mcs.
545                  */
546                 internal Module AddModule (string fileName)
547                 {
548                         if (fileName == null)
549                                 throw new ArgumentNullException (fileName);
550
551                         Module m = InternalAddModule (fileName);
552
553                         if (loaded_modules != null) {
554                                 Module[] new_modules = new Module [loaded_modules.Length + 1];
555                                 System.Array.Copy (loaded_modules, new_modules, loaded_modules.Length);
556                                 loaded_modules = new_modules;
557                         } else {
558                                 loaded_modules = new Module [1];
559                         }
560                         loaded_modules [loaded_modules.Length - 1] = m;
561
562                         return m;
563                 }
564
565                 public IResourceWriter DefineResource (string name, string description, string fileName)
566                 {
567                         return DefineResource (name, description, fileName, ResourceAttributes.Public);
568                 }
569
570                 public IResourceWriter DefineResource (string name, string description,
571                                                        string fileName, ResourceAttributes attribute)
572                 {
573                         IResourceWriter writer;
574
575                         // description seems to be ignored
576                         AddResourceFile (name, fileName, attribute, false);
577                         writer = new ResourceWriter (fileName);
578                         if (resource_writers == null)
579                                 resource_writers = new ArrayList ();
580                         resource_writers.Add (writer);
581                         return writer;
582                 }
583
584                 private void AddUnmanagedResource (Win32Resource res) {
585                         MemoryStream ms = new MemoryStream ();
586                         res.WriteTo (ms);
587
588                         if (win32_resources != null) {
589                                 MonoWin32Resource[] new_res = new MonoWin32Resource [win32_resources.Length + 1];
590                                 System.Array.Copy (win32_resources, new_res, win32_resources.Length);
591                                 win32_resources = new_res;
592                         }
593                         else
594                                 win32_resources = new MonoWin32Resource [1];
595
596                         win32_resources [win32_resources.Length - 1] = new MonoWin32Resource (res.Type.Id, res.Name.Id, res.Language, ms.ToArray ());
597                 }
598
599                 [MonoTODO ("Not currently implemenented")]
600                 public void DefineUnmanagedResource (byte[] resource)
601                 {
602                         if (resource == null)
603                                 throw new ArgumentNullException ("resource");
604                         if (native_resource != NativeResourceType.None)
605                                 throw new ArgumentException ("Native resource has already been defined.");
606
607                         // avoid definition of more than one unmanaged resource
608                         native_resource = NativeResourceType.Unmanaged;
609
610                         /*
611                          * The format of the argument byte array is not documented
612                          * so this method is impossible to implement.
613                          *
614                          * https://connect.microsoft.com/VisualStudio/feedback/details/95784/fatal-assemblybuilder-defineunmanagedresource-byte-and-modulebuilder-defineunmanagedresource-byte-bugs-renders-them-useless
615                          */
616
617                         throw new NotImplementedException ();
618                 }
619
620                 public void DefineUnmanagedResource (string resourceFileName)
621                 {
622                         if (resourceFileName == null)
623                                 throw new ArgumentNullException ("resourceFileName");
624                         if (resourceFileName.Length == 0)
625                                 throw new ArgumentException ("resourceFileName");
626                         if (!File.Exists (resourceFileName) || Directory.Exists (resourceFileName))
627                                 throw new FileNotFoundException ("File '" + resourceFileName + "' does not exists or is a directory.");
628                         if (native_resource != NativeResourceType.None)
629                                 throw new ArgumentException ("Native resource has already been defined.");
630
631                         // avoid definition of more than one unmanaged resource
632                         native_resource = NativeResourceType.Unmanaged;
633
634                         using (FileStream fs = new FileStream (resourceFileName, FileMode.Open, FileAccess.Read)) {
635                                 Win32ResFileReader reader = new Win32ResFileReader (fs);
636
637                                 foreach (Win32EncodedResource res in reader.ReadResources ()) {
638                                         if (res.Name.IsName || res.Type.IsName)
639                                                 throw new InvalidOperationException ("resource files with named resources or non-default resource types are not supported.");
640
641                                         AddUnmanagedResource (res);
642                                 }
643                         }
644                 }
645
646                 public void DefineVersionInfoResource ()
647                 {
648                         if (native_resource != NativeResourceType.None)
649                                 throw new ArgumentException ("Native resource has already been defined.");
650
651                         // avoid definition of more than one unmanaged resource
652                         native_resource = NativeResourceType.Assembly;
653
654                         version_res = new Win32VersionResource (1, 0, IsCompilerContext);
655                 }
656
657                 public void DefineVersionInfoResource (string product, string productVersion,
658                                                        string company, string copyright, string trademark)
659                 {
660                         if (native_resource != NativeResourceType.None)
661                                 throw new ArgumentException ("Native resource has already been defined.");
662
663                         // avoid definition of more than one unmanaged resource
664                         native_resource = NativeResourceType.Explicit;
665
666                         /*
667                          * We can only create the resource later, when the file name and
668                          * the binary version is known.
669                          */
670
671                         version_res = new Win32VersionResource (1, 0, false);
672                         version_res.ProductName = product != null ? product : " ";
673                         version_res.ProductVersion = productVersion != null ? productVersion : " ";
674                         version_res.CompanyName = company != null ? company : " ";
675                         version_res.LegalCopyright = copyright != null ? copyright : " ";
676                         version_res.LegalTrademarks = trademark != null ? trademark : " ";
677                 }
678
679                 /* 
680                  * Mono extension to support /win32icon in mcs
681                  */
682                 internal void DefineIconResource (string iconFileName)
683                 {
684                         if (iconFileName == null)
685                                 throw new ArgumentNullException ("iconFileName");
686                         if (iconFileName.Length == 0)
687                                 throw new ArgumentException ("iconFileName");
688                         if (!File.Exists (iconFileName) || Directory.Exists (iconFileName))
689                                 throw new FileNotFoundException ("File '" + iconFileName + "' does not exists or is a directory.");
690
691                         using (FileStream fs = new FileStream (iconFileName, FileMode.Open, FileAccess.Read)) {
692                                 Win32IconFileReader reader = new Win32IconFileReader (fs);
693                                 
694                                 ICONDIRENTRY[] entries = reader.ReadIcons ();
695
696                                 Win32IconResource[] icons = new Win32IconResource [entries.Length];
697                                 for (int i = 0; i < entries.Length; ++i) {
698                                         icons [i] = new Win32IconResource (i + 1, 0, entries [i]);
699                                         AddUnmanagedResource (icons [i]);
700                                 }
701
702                                 Win32GroupIconResource group = new Win32GroupIconResource (1, 0, icons);
703                                 AddUnmanagedResource (group);
704                         }
705                 }
706
707                 private void DefineVersionInfoResourceImpl (string fileName)
708                 {
709                         if (versioninfo_culture != null)
710                                 version_res.FileLanguage = new CultureInfo (versioninfo_culture).LCID;
711                         version_res.Version = version == null ? "0.0.0.0" : version;
712
713                         if (cattrs != null) {
714                                 switch (native_resource) {
715                                 case NativeResourceType.Assembly:
716                                         foreach (CustomAttributeBuilder cb in cattrs) {
717                                                 string attrname = cb.Ctor.ReflectedType.FullName;
718
719                                                 if (attrname == "System.Reflection.AssemblyProductAttribute")
720                                                         version_res.ProductName = cb.string_arg ();
721                                                 else if (attrname == "System.Reflection.AssemblyCompanyAttribute")
722                                                         version_res.CompanyName = cb.string_arg ();
723                                                 else if (attrname == "System.Reflection.AssemblyCopyrightAttribute")
724                                                         version_res.LegalCopyright = cb.string_arg ();
725                                                 else if (attrname == "System.Reflection.AssemblyTrademarkAttribute")
726                                                         version_res.LegalTrademarks = cb.string_arg ();
727                                                 else if (attrname == "System.Reflection.AssemblyCultureAttribute") {
728                                                         if (!IsCompilerContext)
729                                                                 version_res.FileLanguage = new CultureInfo (cb.string_arg ()).LCID;
730                                                 } else if (attrname == "System.Reflection.AssemblyFileVersionAttribute") {
731                                                         string fileversion = cb.string_arg ();
732                                                         if (!IsCompilerContext || fileversion != null && fileversion.Length != 0)
733                                                                 version_res.FileVersion = fileversion;
734                                                 } else if (attrname == "System.Reflection.AssemblyInformationalVersionAttribute")
735                                                         version_res.ProductVersion = cb.string_arg ();
736                                                 else if (attrname == "System.Reflection.AssemblyTitleAttribute")
737                                                         version_res.FileDescription = cb.string_arg ();
738                                                 else if (attrname == "System.Reflection.AssemblyDescriptionAttribute")
739                                                         version_res.Comments = cb.string_arg ();
740                                         }
741                                         break;
742                                 case NativeResourceType.Explicit:
743                                         foreach (CustomAttributeBuilder cb in cattrs) {
744                                                 string attrname = cb.Ctor.ReflectedType.FullName;
745
746                                                 if (attrname == "System.Reflection.AssemblyCultureAttribute") {
747                                                         if (!IsCompilerContext)
748                                                                 version_res.FileLanguage = new CultureInfo (cb.string_arg ()).LCID;
749                                                 } else if (attrname == "System.Reflection.AssemblyDescriptionAttribute")
750                                                         version_res.Comments = cb.string_arg ();
751                                         }
752                                         break;
753                                 }
754                         }
755
756                         version_res.OriginalFilename = fileName;
757
758                         if (IsCompilerContext) {
759                                 version_res.InternalName = fileName;
760                                 if (version_res.ProductVersion.Trim ().Length == 0)
761                                         version_res.ProductVersion = version_res.FileVersion;
762                         } else {
763                                 version_res.InternalName = Path.GetFileNameWithoutExtension (fileName);
764                         }
765
766                         AddUnmanagedResource (version_res);
767                 }
768
769                 public ModuleBuilder GetDynamicModule (string name)
770                 {
771                         if (name == null)
772                                 throw new ArgumentNullException ("name");
773                         if (name.Length == 0)
774                                 throw new ArgumentException ("Empty name is not legal.", "name");
775
776                         if (modules != null)
777                                 for (int i = 0; i < modules.Length; ++i)
778                                         if (modules [i].name == name)
779                                                 return modules [i];
780                         return null;
781                 }
782
783                 public override Type[] GetExportedTypes ()
784                 {
785                         throw not_supported ();
786                 }
787
788                 public override FileStream GetFile (string name)
789                 {
790                         throw not_supported ();
791                 }
792
793                 public override FileStream[] GetFiles(bool getResourceModules) {
794                         throw not_supported ();
795                 }
796
797                 internal override Module[] GetModulesInternal () {
798                         if (modules == null)
799                                 return new Module [0];
800                         else
801                                 return (Module[])modules.Clone ();
802                 }
803
804                 internal override Type[] GetTypes (bool exportedOnly) {
805                         Type[] res = null;
806                         if (modules != null) {
807                                 for (int i = 0; i < modules.Length; ++i) {
808                                         Type[] types = modules [i].GetTypes ();
809                                         if (res == null)
810                                                 res = types;
811                                         else {
812                                                 Type[] tmp = new Type [res.Length + types.Length];
813                                                 Array.Copy (res, 0, tmp, 0, res.Length);
814                                                 Array.Copy (types, 0, tmp, res.Length, types.Length);
815                                         }
816                                 }
817                         }
818                         if (loaded_modules != null) {
819                                 for (int i = 0; i < loaded_modules.Length; ++i) {
820                                         Type[] types = loaded_modules [i].GetTypes ();
821                                         if (res == null)
822                                                 res = types;
823                                         else {
824                                                 Type[] tmp = new Type [res.Length + types.Length];
825                                                 Array.Copy (res, 0, tmp, 0, res.Length);
826                                                 Array.Copy (types, 0, tmp, res.Length, types.Length);
827                                         }
828                                 }
829                         }
830
831                         if (res != null) {
832                                 List<Exception> exceptions = null;
833                                 foreach (var type in res) {
834                                         if (type is TypeBuilder) {
835                                                 if (exceptions == null)
836                                                         exceptions = new List <Exception> ();
837                                                 exceptions.Add (new TypeLoadException (string.Format ("Type '{0}' is not finished", type.FullName))); 
838                                         }
839                                 }
840                                 if (exceptions != null)
841                                         throw new ReflectionTypeLoadException (new Type [exceptions.Count], exceptions.ToArray ());
842                         }
843                         
844                         return res == null ? Type.EmptyTypes : res;
845                 }
846
847                 public override ManifestResourceInfo GetManifestResourceInfo(string resourceName) {
848                         throw not_supported ();
849                 }
850
851                 public override string[] GetManifestResourceNames() {
852                         throw not_supported ();
853                 }
854
855                 public override Stream GetManifestResourceStream(string name) {
856                         throw not_supported ();
857                 }
858                 public override Stream GetManifestResourceStream(Type type, string name) {
859                         throw not_supported ();
860                 }
861
862                 /*
863                  * This is set when the the AssemblyBuilder is created by (g)mcs
864                  * or vbnc.
865                  */
866                 internal bool IsCompilerContext
867                 {
868                         get { return is_compiler_context; }
869                 }
870
871                 internal bool IsSave {
872                         get {
873                                 return access != (uint)AssemblyBuilderAccess.Run;
874                         }
875                 }
876
877                 internal bool IsRun {
878                         get {
879                                 return access == (uint)AssemblyBuilderAccess.Run || access == (uint)AssemblyBuilderAccess.RunAndSave
880 #if NET_4_0
881                                          || access == (uint)AssemblyBuilderAccess.RunAndCollect
882 #endif
883                                 ;
884
885                         }
886                 }
887
888                 internal string AssemblyDir {
889                         get {
890                                 return dir;
891                         }
892                 }
893
894                 /*
895                  * Mono extension. If this is set, the assembly can only contain one
896                  * module, access should be Save, and the saved image will not contain an
897                  * assembly manifest.
898                  */
899                 internal bool IsModuleOnly {
900                         get {
901                                 return is_module_only;
902                         }
903                         set {
904                                 is_module_only = value;
905                         }
906                 }
907
908                 ModuleBuilder manifest_module;
909
910                 //
911                 // MS.NET seems to return a ModuleBuilder when GetManifestModule () is called
912                 // on an assemblybuilder.
913                 //
914                 internal override Module GetManifestModule () {
915                         if (manifest_module == null)
916                                 manifest_module = DefineDynamicModule ("Default Dynamic Module");
917                         return manifest_module;
918                 }
919
920                 [MonoLimitation ("No support for PE32+ assemblies for AMD64 and IA64")]
921                 public 
922                 void Save (string assemblyFileName, PortableExecutableKinds portableExecutableKind, ImageFileMachine imageFileMachine)
923                 {
924                         this.peKind = portableExecutableKind;
925                         this.machine = imageFileMachine;
926
927                         if ((peKind & PortableExecutableKinds.PE32Plus) != 0 || (peKind & PortableExecutableKinds.Unmanaged32Bit) != 0)
928                                 throw new NotImplementedException (peKind.ToString ());
929                         if (machine == ImageFileMachine.IA64 || machine == ImageFileMachine.AMD64)
930                                 throw new NotImplementedException (machine.ToString ());
931
932                         if (resource_writers != null) {
933                                 foreach (IResourceWriter writer in resource_writers) {
934                                         writer.Generate ();
935                                         writer.Close ();
936                                 }
937                         }
938
939                         // Create a main module if not already created
940                         ModuleBuilder mainModule = null;
941                         if (modules != null) {
942                                 foreach (ModuleBuilder module in modules)
943                                         if (module.FullyQualifiedName == assemblyFileName)
944                                                 mainModule = module;
945                         }
946                         if (mainModule == null)
947                                 mainModule = DefineDynamicModule ("RefEmit_OnDiskManifestModule", assemblyFileName);
948
949                         if (!is_module_only)
950                                 mainModule.IsMain = true;
951
952                         /* 
953                          * Create a new entry point if the one specified
954                          * by the user is in another module.
955                          */
956                         if ((entry_point != null) && entry_point.DeclaringType.Module != mainModule) {
957                                 Type[] paramTypes;
958                                 if (entry_point.GetParameters ().Length == 1)
959                                         paramTypes = new Type [] { typeof (string) };
960                                 else
961                                         paramTypes = Type.EmptyTypes;
962
963                                 MethodBuilder mb = mainModule.DefineGlobalMethod ("__EntryPoint$", MethodAttributes.Static|MethodAttributes.PrivateScope, entry_point.ReturnType, paramTypes);
964                                 ILGenerator ilgen = mb.GetILGenerator ();
965                                 if (paramTypes.Length == 1)
966                                         ilgen.Emit (OpCodes.Ldarg_0);
967                                 ilgen.Emit (OpCodes.Tailcall);
968                                 ilgen.Emit (OpCodes.Call, entry_point);
969                                 ilgen.Emit (OpCodes.Ret);
970
971                                 entry_point = mb;
972                         }
973
974                         if (version_res != null)
975                                 DefineVersionInfoResourceImpl (assemblyFileName);
976
977                         if (sn != null) {
978                                 // runtime needs to value to embed it into the assembly
979                                 public_key = sn.PublicKey;
980                         }
981
982                         foreach (ModuleBuilder module in modules)
983                                 if (module != mainModule)
984                                         module.Save ();
985
986                         // Write out the main module at the end, because it needs to
987                         // contain the hash of the other modules
988                         mainModule.Save ();
989
990                         if ((sn != null) && (sn.CanSign)) {
991                                 sn.Sign (System.IO.Path.Combine (this.AssemblyDir, assemblyFileName));
992                         }
993
994                         created = true;
995                 }
996
997                 public void Save (string assemblyFileName)
998                 {
999                         Save (assemblyFileName, PortableExecutableKinds.ILOnly, ImageFileMachine.I386);
1000                 }
1001
1002                 public void SetEntryPoint (MethodInfo entryMethod)
1003                 {
1004                         SetEntryPoint (entryMethod, PEFileKinds.ConsoleApplication);
1005                 }
1006
1007                 public void SetEntryPoint (MethodInfo entryMethod, PEFileKinds fileKind)
1008                 {
1009                         if (entryMethod == null)
1010                                 throw new ArgumentNullException ("entryMethod");
1011                         if (entryMethod.DeclaringType.Assembly != this)
1012                                 throw new InvalidOperationException ("Entry method is not defined in the same assembly.");
1013
1014                         entry_point = entryMethod;
1015                         pekind = fileKind;
1016                 }
1017
1018                 public void SetCustomAttribute( CustomAttributeBuilder customBuilder) 
1019                 {
1020                         if (customBuilder == null)
1021                                 throw new ArgumentNullException ("customBuilder");
1022
1023                         if (IsCompilerContext) {
1024                                 string attrname = customBuilder.Ctor.ReflectedType.FullName;
1025                                 byte [] data;
1026                                 int pos;
1027
1028                                 if (attrname == "System.Reflection.AssemblyVersionAttribute") {
1029                                         version = create_assembly_version (customBuilder.string_arg ());
1030                                         return;
1031                                 } else if (attrname == "System.Reflection.AssemblyCultureAttribute") {
1032                                         culture = GetCultureString (customBuilder.string_arg ());
1033                                 } else if (attrname == "System.Reflection.AssemblyAlgorithmIdAttribute") {
1034                                         data = customBuilder.Data;
1035                                         pos = 2;
1036                                         algid = (uint) data [pos];
1037                                         algid |= ((uint) data [pos + 1]) << 8;
1038                                         algid |= ((uint) data [pos + 2]) << 16;
1039                                         algid |= ((uint) data [pos + 3]) << 24;
1040                                 } else if (attrname == "System.Reflection.AssemblyFlagsAttribute") {
1041                                         data = customBuilder.Data;
1042                                         pos = 2;
1043                                         flags |= (uint) data [pos];
1044                                         flags |= ((uint) data [pos + 1]) << 8;
1045                                         flags |= ((uint) data [pos + 2]) << 16;
1046                                         flags |= ((uint) data [pos + 3]) << 24;
1047
1048                                         // ignore PublicKey flag if assembly is not strongnamed
1049                                         if (sn == null)
1050                                                 flags &= ~(uint) AssemblyNameFlags.PublicKey;
1051                                 }
1052                         }
1053
1054                         if (cattrs != null) {
1055                                 CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
1056                                 cattrs.CopyTo (new_array, 0);
1057                                 new_array [cattrs.Length] = customBuilder;
1058                                 cattrs = new_array;
1059                         } else {
1060                                 cattrs = new CustomAttributeBuilder [1];
1061                                 cattrs [0] = customBuilder;
1062                         }
1063                 }
1064
1065                 [ComVisible (true)]
1066                 public void SetCustomAttribute ( ConstructorInfo con, byte[] binaryAttribute) {
1067                         if (con == null)
1068                                 throw new ArgumentNullException ("con");
1069                         if (binaryAttribute == null)
1070                                 throw new ArgumentNullException ("binaryAttribute");
1071
1072                         SetCustomAttribute (new CustomAttributeBuilder (con, binaryAttribute));
1073                 }
1074
1075                 internal void SetCorlibTypeBuilders (Type corlib_object_type, Type corlib_value_type, Type corlib_enum_type) {
1076                         this.corlib_object_type = corlib_object_type;
1077                         this.corlib_value_type = corlib_value_type;
1078                         this.corlib_enum_type = corlib_enum_type;
1079                 }
1080
1081                 internal void SetCorlibTypeBuilders (Type corlib_object_type, Type corlib_value_type, Type corlib_enum_type, Type corlib_void_type)
1082                 {
1083                         SetCorlibTypeBuilders (corlib_object_type, corlib_value_type, corlib_enum_type);
1084                         this.corlib_void_type = corlib_void_type;
1085                 }
1086
1087                 private Exception not_supported () {
1088                         // Strange message but this is what MS.NET prints...
1089                         return new NotSupportedException ("The invoked member is not supported in a dynamic module.");
1090                 }
1091
1092                 private void check_name_and_filename (string name, string fileName,
1093                                                                                           bool fileNeedsToExists) {
1094                         if (name == null)
1095                                 throw new ArgumentNullException ("name");
1096                         if (fileName == null)
1097                                 throw new ArgumentNullException ("fileName");
1098                         if (name.Length == 0)
1099                                 throw new ArgumentException ("Empty name is not legal.", "name");
1100                         if (fileName.Length == 0)
1101                                 throw new ArgumentException ("Empty file name is not legal.", "fileName");
1102                         if (Path.GetFileName (fileName) != fileName)
1103                                 throw new ArgumentException ("fileName '" + fileName + "' must not include a path.", "fileName");
1104
1105                         // Resource files are created/searched under the assembly storage
1106                         // directory
1107                         string fullFileName = fileName;
1108                         if (dir != null)
1109                                 fullFileName = Path.Combine (dir, fileName);
1110
1111                         if (fileNeedsToExists && !File.Exists (fullFileName))
1112                                 throw new FileNotFoundException ("Could not find file '" + fileName + "'");
1113
1114                         if (resources != null) {
1115                                 for (int i = 0; i < resources.Length; ++i) {
1116                                         if (resources [i].filename == fullFileName)
1117                                                 throw new ArgumentException ("Duplicate file name '" + fileName + "'");
1118                                         if (resources [i].name == name)
1119                                                 throw new ArgumentException ("Duplicate name '" + name + "'");
1120                                 }
1121                         }
1122
1123                         if (modules != null) {
1124                                 for (int i = 0; i < modules.Length; ++i) {
1125                                         // Use fileName instead of fullFileName here
1126                                         if (!modules [i].IsTransient () && (modules [i].FileName == fileName))
1127                                                 throw new ArgumentException ("Duplicate file name '" + fileName + "'");
1128                                         if (modules [i].Name == name)
1129                                                 throw new ArgumentException ("Duplicate name '" + name + "'");
1130                                 }
1131                         }
1132                 }
1133
1134                 private String create_assembly_version (String version) {
1135                         String[] parts = version.Split ('.');
1136                         int[] ver = new int [4] { 0, 0, 0, 0 };
1137
1138                         if ((parts.Length < 0) || (parts.Length > 4))
1139                                 throw new ArgumentException ("The version specified '" + version + "' is invalid");
1140
1141                         for (int i = 0; i < parts.Length; ++i) {
1142                                 if (parts [i] == "*") {
1143                                         DateTime now = DateTime.Now;
1144
1145                                         if (i == 2) {
1146                                                 ver [2] = (now - new DateTime (2000, 1, 1)).Days;
1147                                                 if (parts.Length == 3)
1148                                                         ver [3] = (now.Second + (now.Minute * 60) + (now.Hour * 3600)) / 2;
1149                                         }
1150                                         else
1151                                                 if (i == 3)
1152                                                         ver [3] = (now.Second + (now.Minute * 60) + (now.Hour * 3600)) / 2;
1153                                         else
1154                                                 throw new ArgumentException ("The version specified '" + version + "' is invalid");
1155                                 }
1156                                 else {
1157                                         try {
1158                                                 ver [i] = Int32.Parse (parts [i]);
1159                                         }
1160                                         catch (FormatException) {
1161                                                 throw new ArgumentException ("The version specified '" + version + "' is invalid");
1162                                         }
1163                                 }
1164                         }
1165
1166                         return ver [0] + "." + ver [1] + "." + ver [2] + "." + ver [3];
1167                 }
1168
1169                 private string GetCultureString (string str)
1170                 {
1171                         return (str == "neutral" ? String.Empty : str);
1172                 }
1173
1174                 internal override AssemblyName UnprotectedGetName ()
1175                 {
1176                         AssemblyName an = base.UnprotectedGetName ();
1177                         if (sn != null) {
1178                                 an.SetPublicKey (sn.PublicKey);
1179                                 an.SetPublicKeyToken (sn.PublicKeyToken);
1180                         }
1181                         return an;
1182                 }
1183
1184                 /*Warning, @typeArguments must be a mscorlib internal array. So make a copy before passing it in*/
1185                 internal Type MakeGenericType (Type gtd, Type[] typeArguments)
1186                 {
1187                         if (!IsCompilerContext)
1188                                 return new MonoGenericClass (gtd, typeArguments);
1189
1190                         GenericInstanceKey key = new GenericInstanceKey (gtd, typeArguments);
1191                         MonoGenericClass res = (MonoGenericClass)generic_instances [key];
1192                         if (res == null) {
1193                                 res = new MonoGenericClass (gtd, typeArguments);
1194                                 generic_instances [key] = res;
1195                         }
1196                         return res;
1197                 }
1198
1199                 void _AssemblyBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
1200                 {
1201                         throw new NotImplementedException ();
1202                 }
1203
1204                 void _AssemblyBuilder.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
1205                 {
1206                         throw new NotImplementedException ();
1207                 }
1208
1209                 void _AssemblyBuilder.GetTypeInfoCount (out uint pcTInfo)
1210                 {
1211                         throw new NotImplementedException ();
1212                 }
1213
1214                 void _AssemblyBuilder.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
1215                 {
1216                         throw new NotImplementedException ();
1217                 }
1218
1219 #if NET_4_0 || MOONLIGHT
1220                 public override Type GetType (string name, bool throwOnError, bool ignoreCase)
1221                 {
1222                         if (name == null)
1223                                 throw new ArgumentNullException (name);
1224                         if (name.Length == 0)
1225                         throw new ArgumentException ("name", "Name cannot be empty");
1226
1227                         var res = InternalGetType (null, name, throwOnError, ignoreCase);
1228                         if (res is TypeBuilder) {
1229                                 if (throwOnError)
1230                                         throw new TypeLoadException (string.Format ("Could not load type '{0}' from assembly '{1}'", name, this.name));
1231                                 return null;
1232                         }
1233                         return res;
1234                 }
1235
1236                 public override Module GetModule (String name)
1237                 {
1238                         if (name == null)
1239                                 throw new ArgumentNullException ("name");
1240                         if (name.Length == 0)
1241                                 throw new ArgumentException ("Name can't be empty");
1242
1243                         if (modules == null)
1244                                 return null;
1245
1246                         foreach (Module module in modules) {
1247                                 if (module.ScopeName == name)
1248                                         return module;
1249                         }
1250
1251                         return null;
1252                 }
1253
1254                 public override Module[] GetModules (bool getResourceModules)
1255                 {
1256                         Module[] modules = GetModulesInternal ();
1257
1258                         if (!getResourceModules) {
1259                                 ArrayList result = new ArrayList (modules.Length);
1260                                 foreach (Module m in modules)
1261                                         if (!m.IsResource ())
1262                                                 result.Add (m);
1263                                 return (Module[])result.ToArray (typeof (Module));
1264                         }
1265                         return modules;
1266                 }
1267
1268                 [MonoTODO ("This always returns an empty array")]
1269                 public override AssemblyName[] GetReferencedAssemblies () {
1270                         return GetReferencedAssemblies (this);
1271                 }
1272
1273                 public override Module[] GetLoadedModules (bool getResourceModules)
1274                 {
1275                         return GetModules (getResourceModules);
1276                 }
1277
1278                 //FIXME MS has issues loading satelite assemblies from SRE
1279                 public override Assembly GetSatelliteAssembly (CultureInfo culture)
1280                 {
1281                         return GetSatelliteAssembly (culture, null, true);
1282                 }
1283
1284                 //FIXME MS has issues loading satelite assemblies from SRE
1285                 public override Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
1286                 {
1287                         return GetSatelliteAssembly (culture, version, true);
1288                 }
1289
1290                 public override Module ManifestModule {
1291                         get {
1292                                 return GetManifestModule ();
1293                         }
1294                 }
1295
1296                 public override bool GlobalAssemblyCache {
1297                         get {
1298                                 return false;
1299                         }
1300                 }
1301
1302                 public override bool IsDynamic {
1303                         get { return true; }
1304                 }
1305 #endif
1306         }
1307 }