2 // System.Reflection/Assembly.cs
5 // Paolo Molaro (lupus@ximian.com)
7 // (C) 2001 Ximian, Inc. http://www.ximian.com
8 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
9 // Copyright 2011 Xamarin Inc (http://www.xamarin.com).
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 using System.Security;
32 using System.Security.Policy;
33 using System.Security.Permissions;
34 using System.Runtime.Serialization;
35 using System.Reflection;
37 using System.Globalization;
38 using System.Runtime.CompilerServices;
39 using System.Runtime.InteropServices;
40 using System.Collections.Generic;
41 using System.Configuration.Assemblies;
45 namespace System.Reflection {
48 [ComDefaultInterfaceAttribute (typeof (_Assembly))]
50 [ClassInterface(ClassInterfaceType.None)]
51 [StructLayout (LayoutKind.Sequential)]
53 public partial class Assembly : ICustomAttributeProvider {
55 public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
57 public partial class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
59 internal class ResolveEventHolder {
60 public event ModuleResolveEventHandler ModuleResolve;
63 // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
64 #pragma warning disable 649
65 private IntPtr _mono_assembly;
66 #pragma warning restore 649
68 private ResolveEventHolder resolve_event_holder;
70 private Evidence _evidence;
71 internal PermissionSet _minimum; // for SecurityAction.RequestMinimum
72 internal PermissionSet _optional; // for SecurityAction.RequestOptional
73 internal PermissionSet _refuse; // for SecurityAction.RequestRefuse
74 private PermissionSet _granted; // for the resolved assembly granted permissions
75 private PermissionSet _denied; // for the resolved assembly denied permissions
77 object _evidence, _minimum, _optional, _refuse, _granted, _denied;
79 private bool fromByteArray;
80 private string assemblyName;
89 resolve_event_holder = new ResolveEventHolder ();
93 // We can't store the event directly in this class, since the
94 // compiler would silently insert the fields before _mono_assembly
96 public event ModuleResolveEventHandler ModuleResolve {
97 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
99 resolve_event_holder.ModuleResolve += value;
101 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
103 resolve_event_holder.ModuleResolve -= value;
107 [MethodImplAttribute (MethodImplOptions.InternalCall)]
108 private extern string get_code_base (bool escaped);
110 [MethodImplAttribute (MethodImplOptions.InternalCall)]
111 private extern string get_fullname ();
113 [MethodImplAttribute (MethodImplOptions.InternalCall)]
114 private extern string get_location ();
116 [MethodImplAttribute (MethodImplOptions.InternalCall)]
117 private extern string InternalImageRuntimeVersion ();
119 // SECURITY: this should be the only caller to icall get_code_base
120 private string GetCodeBase (bool escaped)
122 string cb = get_code_base (escaped);
124 if (SecurityManager.SecurityEnabled) {
125 // we cannot divulge local file informations
126 if (String.Compare ("FILE://", 0, cb, 0, 7, true, CultureInfo.InvariantCulture) == 0) {
127 string file = cb.Substring (7);
128 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, file).Demand ();
135 public virtual string CodeBase {
136 get { return GetCodeBase (false); }
139 public virtual string EscapedCodeBase {
140 get { return GetCodeBase (true); }
143 public virtual string FullName {
146 // FIXME: This is wrong, but it gets us going
147 // in the compiler for now
153 public virtual extern MethodInfo EntryPoint {
154 [MethodImplAttribute (MethodImplOptions.InternalCall)]
158 public virtual Evidence Evidence {
159 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
160 get { return UnprotectedGetEvidence (); }
163 // note: the security runtime requires evidences but may be unable to do so...
164 internal Evidence UnprotectedGetEvidence ()
169 // if the host (runtime) hasn't provided it's own evidence...
170 if (_evidence == null) {
171 // ... we will provide our own
173 _evidence = Evidence.GetDefaultHostEvidence (this);
180 [MethodImplAttribute (MethodImplOptions.InternalCall)]
181 internal extern bool get_global_assembly_cache ();
183 internal bool FromByteArray {
184 set { fromByteArray = value; }
187 public virtual String Location {
192 string loc = get_location ();
194 if ((loc != String.Empty) && SecurityManager.SecurityEnabled) {
195 // we cannot divulge local file informations
196 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, loc).Demand ();
204 public virtual string ImageRuntimeVersion {
206 return InternalImageRuntimeVersion ();
210 [SecurityPermission (SecurityAction.LinkDemand, SerializationFormatter = true)]
211 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
214 throw new ArgumentNullException ("info");
216 UnitySerializationHolder.GetAssemblyData (this, info, context);
219 public virtual bool IsDefined (Type attributeType, bool inherit)
221 return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
224 public virtual object [] GetCustomAttributes (bool inherit)
226 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
229 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
231 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
234 [MethodImplAttribute (MethodImplOptions.InternalCall)]
235 private extern object GetFilesInternal (String name, bool getResourceModules);
237 public virtual FileStream[] GetFiles ()
239 return GetFiles (false);
242 public virtual FileStream [] GetFiles (bool getResourceModules)
244 string[] names = (string[]) GetFilesInternal (null, getResourceModules);
246 return EmptyArray<FileStream>.Value;
248 string location = Location;
251 if (location != String.Empty) {
252 res = new FileStream [names.Length + 1];
253 res [0] = new FileStream (location, FileMode.Open, FileAccess.Read);
254 for (int i = 0; i < names.Length; ++i)
255 res [i + 1] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
257 res = new FileStream [names.Length];
258 for (int i = 0; i < names.Length; ++i)
259 res [i] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
264 public virtual FileStream GetFile (String name)
267 throw new ArgumentNullException (null, "Name cannot be null.");
268 if (name.Length == 0)
269 throw new ArgumentException ("Empty name is not valid");
271 string filename = (string)GetFilesInternal (name, true);
272 if (filename != null)
273 return new FileStream (filename, FileMode.Open, FileAccess.Read);
278 [MethodImplAttribute (MethodImplOptions.InternalCall)]
279 internal extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
281 public virtual Stream GetManifestResourceStream (String name)
284 throw new ArgumentNullException ("name");
285 if (name.Length == 0)
286 throw new ArgumentException ("String cannot have zero length.",
289 ManifestResourceInfo info = GetManifestResourceInfo (name);
291 Assembly a = AppDomain.CurrentDomain.DoResourceResolve (name, this);
292 if (a != null && a != this)
293 return a.GetManifestResourceStream (name);
298 if (info.ReferencedAssembly != null)
299 return info.ReferencedAssembly.GetManifestResourceStream (name);
300 if ((info.FileName != null) && (info.ResourceLocation == 0)) {
302 throw new FileNotFoundException (info.FileName);
304 string location = Path.GetDirectoryName (Location);
305 string filename = Path.Combine (location, info.FileName);
306 return new FileStream (filename, FileMode.Open, FileAccess.Read);
311 IntPtr data = GetManifestResourceInternal (name, out size, out module);
312 if (data == (IntPtr) 0)
315 UnmanagedMemoryStream stream;
317 stream = new UnmanagedMemoryStream ((byte*) data, size);
320 * The returned pointer points inside metadata, so
321 * we have to increase the refcount of the module, and decrease
322 * it when the stream is finalized.
324 stream.Closed += new EventHandler (new ResourceCloseHandler (module).OnClose);
329 public virtual Stream GetManifestResourceStream (Type type, String name)
336 throw new ArgumentNullException ("type");
340 if (ns == null || ns.Length == 0)
341 return GetManifestResourceStream (name);
343 return GetManifestResourceStream (ns + "." + name);
346 [MethodImplAttribute (MethodImplOptions.InternalCall)]
347 internal virtual extern Type[] GetTypes (bool exportedOnly);
349 public virtual Type[] GetTypes ()
351 return GetTypes (false);
354 public virtual Type[] GetExportedTypes ()
356 return GetTypes (true);
359 public virtual Type GetType (String name, Boolean throwOnError)
361 return GetType (name, throwOnError, false);
364 public virtual Type GetType (String name) {
365 return GetType (name, false, false);
368 [MethodImplAttribute (MethodImplOptions.InternalCall)]
369 internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);
371 [MethodImplAttribute (MethodImplOptions.InternalCall)]
372 internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
374 [MethodImplAttribute (MethodImplOptions.InternalCall)]
375 static extern void FillName (Assembly ass, AssemblyName aname);
377 [MonoTODO ("copiedName == true is not supported")]
378 public virtual AssemblyName GetName (Boolean copiedName)
381 // CodeBase, which is restricted, will be copied into the AssemblyName object so...
382 if (SecurityManager.SecurityEnabled) {
383 GetCodeBase (true); // this will ensure the Demand is made
386 return UnprotectedGetName ();
389 public virtual AssemblyName GetName ()
391 return GetName (false);
394 // the security runtime requires access to the assemblyname (e.g. to get the strongname)
395 internal virtual AssemblyName UnprotectedGetName ()
397 AssemblyName aname = new AssemblyName ();
398 FillName (this, aname);
402 public override string ToString ()
404 // note: ToString work without requiring CodeBase (so no checks are needed)
406 if (assemblyName != null)
409 assemblyName = get_fullname ();
413 public static String CreateQualifiedName (String assemblyName, String typeName)
415 return typeName + ", " + assemblyName;
418 public static Assembly GetAssembly (Type type)
421 return type.Assembly;
422 throw new ArgumentNullException ("type");
426 [MethodImplAttribute (MethodImplOptions.InternalCall)]
427 public static extern Assembly GetEntryAssembly();
429 internal Assembly GetSatelliteAssemblyNoThrow (CultureInfo culture, Version version)
431 return GetSatelliteAssembly (culture, version, false);
434 internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
437 throw new ArgumentException ("culture");
439 AssemblyName aname = GetName (true);
441 aname.Version = version;
443 aname.CultureInfo = culture;
444 aname.Name = aname.Name + ".resources";
448 assembly = AppDomain.CurrentDomain.LoadSatellite (aname, false);
449 if (assembly != null)
451 } catch (FileNotFoundException) {
456 // Try the assembly directory
457 string location = Path.GetDirectoryName (Location);
458 string fullName = Path.Combine (location, Path.Combine (culture.Name, aname.Name + ".dll"));
459 if (!throwOnError && !File.Exists (fullName))
462 return LoadFrom (fullName);
466 Type _Assembly.GetType ()
468 // Required or object::GetType becomes virtual final
469 return base.GetType ();
473 [MethodImplAttribute (MethodImplOptions.InternalCall)]
474 private extern static Assembly LoadFrom (String assemblyFile, bool refonly);
476 public static Assembly LoadFrom (String assemblyFile)
478 return LoadFrom (assemblyFile, false);
484 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
486 Assembly a = LoadFrom (assemblyFile, false);
488 if ((a != null) && (securityEvidence != null)) {
489 // merge evidence (i.e. replace defaults with provided evidences)
490 a.Evidence.Merge (securityEvidence);
499 [MonoTODO("This overload is not currently implemented")]
500 // FIXME: What are we missing?
501 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
503 throw new NotImplementedException ();
508 public static Assembly LoadFrom (String assemblyFile, byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
510 throw new NotImplementedException ();
515 public static Assembly UnsafeLoadFrom (String assemblyFile)
517 return LoadFrom (assemblyFile);
524 public static Assembly LoadFile (String path, Evidence securityEvidence)
527 throw new ArgumentNullException ("path");
528 if (path == String.Empty)
529 throw new ArgumentException ("Path can't be empty", "path");
530 // FIXME: Make this do the right thing
531 return LoadFrom (path, securityEvidence);
534 public static Assembly LoadFile (String path)
536 return LoadFile (path, null);
539 public static Assembly Load (String assemblyString)
541 return AppDomain.CurrentDomain.Load (assemblyString);
547 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
549 return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
552 public static Assembly Load (AssemblyName assemblyRef)
554 return AppDomain.CurrentDomain.Load (assemblyRef);
560 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
562 return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
565 public static Assembly Load (Byte[] rawAssembly)
567 return AppDomain.CurrentDomain.Load (rawAssembly);
570 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
572 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
578 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
579 Evidence securityEvidence)
581 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
585 [MonoLimitation ("Argument securityContextSource is ignored")]
586 public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
588 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
592 public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
594 return AppDomain.CurrentDomain.Load (rawAssembly, null, null, true);
597 public static Assembly ReflectionOnlyLoad (string assemblyString)
599 return AppDomain.CurrentDomain.Load (assemblyString, null, true);
602 public static Assembly ReflectionOnlyLoadFrom (string assemblyFile)
604 if (assemblyFile == null)
605 throw new ArgumentNullException ("assemblyFile");
607 return LoadFrom (assemblyFile, true);
611 public static Assembly LoadWithPartialName (string partialName)
613 return LoadWithPartialName (partialName, null);
616 [MonoTODO ("Not implemented")]
617 public Module LoadModule (string moduleName, byte [] rawModule)
619 throw new NotImplementedException ();
622 [MonoTODO ("Not implemented")]
627 Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
629 throw new NotImplementedException ();
632 [MethodImplAttribute (MethodImplOptions.InternalCall)]
633 private static extern Assembly load_with_partial_name (string name, Evidence e);
636 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
638 return LoadWithPartialName (partialName, securityEvidence, true);
642 * LAMESPEC: It is possible for this method to throw exceptions IF the name supplied
643 * is a valid gac name and contains filesystem entry charachters at the end of the name
644 * ie System/// will throw an exception. However ////System will not as that is canocolized
648 // FIXME: LoadWithPartialName must look cache (no CAS) or read from disk (CAS)
649 internal static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence, bool oldBehavior)
652 throw new NotImplementedException ();
654 if (partialName == null)
655 throw new NullReferenceException ();
657 return load_with_partial_name (partialName, securityEvidence);
660 public Object CreateInstance (String typeName)
662 return CreateInstance (typeName, false);
665 public Object CreateInstance (String typeName, Boolean ignoreCase)
667 Type t = GetType (typeName, false, ignoreCase);
672 return Activator.CreateInstance (t);
673 } catch (InvalidOperationException) {
674 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
682 Object CreateInstance (String typeName, Boolean ignoreCase,
683 BindingFlags bindingAttr, Binder binder,
684 Object[] args, CultureInfo culture,
685 Object[] activationAttributes)
687 Type t = GetType (typeName, false, ignoreCase);
692 return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
693 } catch (InvalidOperationException) {
694 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
698 public Module[] GetLoadedModules ()
700 return GetLoadedModules (false);
703 public Module[] GetModules ()
705 return GetModules (false);
708 [MethodImplAttribute (MethodImplOptions.InternalCall)]
709 internal virtual extern Module[] GetModulesInternal ();
711 [MethodImplAttribute (MethodImplOptions.InternalCall)]
712 public extern virtual String[] GetManifestResourceNames ();
714 [MethodImplAttribute (MethodImplOptions.InternalCall)]
715 public extern static Assembly GetExecutingAssembly ();
717 [MethodImplAttribute (MethodImplOptions.InternalCall)]
718 public extern static Assembly GetCallingAssembly ();
720 [MethodImplAttribute (MethodImplOptions.InternalCall)]
721 internal static extern AssemblyName[] GetReferencedAssemblies (Assembly module);
723 [MethodImplAttribute (MethodImplOptions.InternalCall)]
724 private extern bool GetManifestResourceInfoInternal (String name, ManifestResourceInfo info);
726 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
728 if (resourceName == null)
729 throw new ArgumentNullException ("resourceName");
730 if (resourceName.Length == 0)
731 throw new ArgumentException ("String cannot have zero length.");
732 ManifestResourceInfo result = new ManifestResourceInfo ();
733 bool found = GetManifestResourceInfoInternal (resourceName, result);
740 private class ResourceCloseHandler {
741 #pragma warning disable 169, 414
743 #pragma warning restore 169, 414
745 public ResourceCloseHandler (Module module) {
746 this.module = module;
749 public void OnClose (object sender, EventArgs e) {
750 // The module dtor will take care of things
756 // The following functions are only for the Mono Debugger.
759 [MethodImplAttribute (MethodImplOptions.InternalCall)]
760 internal static extern int MonoDebugger_GetMethodToken (MethodBase method);
762 [MonoTODO ("Currently it always returns zero")]
773 internal virtual Module GetManifestModule () {
774 return GetManifestModuleInternal ();
777 [MethodImplAttribute (MethodImplOptions.InternalCall)]
778 internal extern Module GetManifestModuleInternal ();
781 public virtual extern bool ReflectionOnly {
782 [MethodImplAttribute (MethodImplOptions.InternalCall)]
786 public override int GetHashCode ()
788 return base.GetHashCode ();
791 public override bool Equals (object o)
793 if (((object) this) == o)
799 Assembly other = (Assembly) o;
800 return other._mono_assembly == _mono_assembly;
804 // Code Access Security
806 internal void Resolve ()
809 // FIXME: As we (currently) delay the resolution until the first CAS
810 // Demand it's too late to evaluate the Minimum permission set as a
811 // condition to load the assembly into the AppDomain
812 LoadAssemblyPermissions ();
813 Evidence e = new Evidence (UnprotectedGetEvidence ()); // we need a copy to add PRE
814 e.AddHost (new PermissionRequestEvidence (_minimum, _optional, _refuse));
815 _granted = SecurityManager.ResolvePolicy (e,
816 _minimum, _optional, _refuse, out _denied);
820 internal PermissionSet GrantedPermissionSet {
822 if (_granted == null) {
823 if (SecurityManager.ResolvingPolicyLevel != null) {
824 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
825 return DefaultPolicies.FullTrust;
827 return null; // we can't resolve during resolution
835 internal PermissionSet DeniedPermissionSet {
837 // yes we look for granted, as denied may be null
838 if (_granted == null) {
839 if (SecurityManager.ResolvingPolicyLevel != null) {
840 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
843 return DefaultPolicies.FullTrust; // deny unrestricted
851 [MethodImplAttribute (MethodImplOptions.InternalCall)]
852 extern internal static bool LoadPermissions (Assembly a,
853 ref IntPtr minimum, ref int minLength,
854 ref IntPtr optional, ref int optLength,
855 ref IntPtr refused, ref int refLength);
857 // Support for SecurityAction.RequestMinimum, RequestOptional and RequestRefuse
858 private void LoadAssemblyPermissions ()
860 IntPtr minimum = IntPtr.Zero, optional = IntPtr.Zero, refused = IntPtr.Zero;
861 int minLength = 0, optLength = 0, refLength = 0;
862 if (LoadPermissions (this, ref minimum, ref minLength, ref optional,
863 ref optLength, ref refused, ref refLength)) {
865 // Note: no need to cache these permission sets as they will only be created once
866 // at assembly resolution time.
868 byte[] data = new byte [minLength];
869 Marshal.Copy (minimum, data, 0, minLength);
870 _minimum = SecurityManager.Decode (data);
873 byte[] data = new byte [optLength];
874 Marshal.Copy (optional, data, 0, optLength);
875 _optional = SecurityManager.Decode (data);
878 byte[] data = new byte [refLength];
879 Marshal.Copy (refused, data, 0, refLength);
880 _refuse = SecurityManager.Decode (data);
886 public virtual PermissionSet PermissionSet {
887 get { return this.GrantedPermissionSet; }
890 public virtual SecurityRuleSet SecurityRuleSet {
891 get { throw CreateNIE (); }
898 static Exception CreateNIE ()
900 return new NotImplementedException ("Derived classes must implement it");
903 public virtual IList<CustomAttributeData> GetCustomAttributesData ()
905 return CustomAttributeData.GetCustomAttributes (this);
909 public bool IsFullyTrusted {
913 public virtual Type GetType (string name, bool throwOnError, bool ignoreCase)
918 public virtual Module GetModule (String name)
923 public virtual AssemblyName[] GetReferencedAssemblies ()
928 public virtual Module[] GetModules (bool getResourceModules)
933 [MonoTODO ("Always returns the same as GetModules")]
934 public virtual Module[] GetLoadedModules (bool getResourceModules)
939 public virtual Assembly GetSatelliteAssembly (CultureInfo culture)
944 public virtual Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
949 public virtual Module ManifestModule {
950 get { throw CreateNIE (); }
953 public virtual bool GlobalAssemblyCache {
954 get { throw CreateNIE (); }
957 public virtual bool IsDynamic {
958 get { return false; }
961 public static bool operator == (Assembly left, Assembly right)
963 if ((object)left == (object)right)
965 if ((object)left == null ^ (object)right == null)
967 return left.Equals (right);
970 public static bool operator != (Assembly left, Assembly right)
972 if ((object)left == (object)right)
974 if ((object)left == null ^ (object)right == null)
976 return !left.Equals (right);
981 public virtual IEnumerable<TypeInfo> DefinedTypes {
983 foreach (var type in GetTypes ())
984 yield return new TypeDelegator (type);
988 public virtual IEnumerable<Type> ExportedTypes {
989 get { return GetExportedTypes (); }
992 public virtual IEnumerable<Module> Modules {
993 get { return GetModules (); }
996 public virtual IEnumerable<CustomAttributeData> CustomAttributes {
997 get { return GetCustomAttributesData (); }