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;
42 using System.Threading;
44 using System.Diagnostics.Contracts;
48 namespace System.Reflection {
51 [ComDefaultInterfaceAttribute (typeof (_Assembly))]
53 [ClassInterface(ClassInterfaceType.None)]
54 [StructLayout (LayoutKind.Sequential)]
56 public partial class Assembly : ICustomAttributeProvider {
58 public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable {
60 internal class ResolveEventHolder {
61 public event ModuleResolveEventHandler ModuleResolve;
64 internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
66 #pragma warning disable 414
68 #pragma warning restore
70 public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
71 : base (pointer, length)
76 protected override void Dispose (bool disposing)
80 * The returned pointer points inside metadata, so
81 * we have to increase the refcount of the module, and decrease
82 * it when the stream is finalized.
87 base.Dispose (disposing);
91 // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
92 #pragma warning disable 649
93 internal IntPtr _mono_assembly;
94 #pragma warning restore 649
96 private ResolveEventHolder resolve_event_holder;
98 private Evidence _evidence;
99 internal PermissionSet _minimum; // for SecurityAction.RequestMinimum
100 internal PermissionSet _optional; // for SecurityAction.RequestOptional
101 internal PermissionSet _refuse; // for SecurityAction.RequestRefuse
102 private PermissionSet _granted; // for the resolved assembly granted permissions
103 private PermissionSet _denied; // for the resolved assembly denied permissions
105 object _evidence, _minimum, _optional, _refuse, _granted, _denied;
107 private bool fromByteArray;
108 private string assemblyName;
113 resolve_event_holder = new ResolveEventHolder ();
117 // We can't store the event directly in this class, since the
118 // compiler would silently insert the fields before _mono_assembly
120 public event ModuleResolveEventHandler ModuleResolve {
121 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
123 resolve_event_holder.ModuleResolve += value;
125 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
127 resolve_event_holder.ModuleResolve -= value;
131 [MethodImplAttribute (MethodImplOptions.InternalCall)]
132 private extern string get_code_base (bool escaped);
134 [MethodImplAttribute (MethodImplOptions.InternalCall)]
135 private extern string get_fullname ();
137 [MethodImplAttribute (MethodImplOptions.InternalCall)]
138 private extern string get_location ();
140 [MethodImplAttribute (MethodImplOptions.InternalCall)]
141 private extern string InternalImageRuntimeVersion ();
143 [MethodImplAttribute (MethodImplOptions.InternalCall)]
144 static internal extern string GetAotId ();
146 // SECURITY: this should be the only caller to icall get_code_base
147 private string GetCodeBase (bool escaped)
149 string cb = get_code_base (escaped);
151 if (SecurityManager.SecurityEnabled) {
152 // we cannot divulge local file informations
153 if (String.Compare ("FILE://", 0, cb, 0, 7, true, CultureInfo.InvariantCulture) == 0) {
154 string file = cb.Substring (7);
155 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, file).Demand ();
162 public virtual string CodeBase {
163 get { return GetCodeBase (false); }
166 public virtual string EscapedCodeBase {
167 get { return GetCodeBase (true); }
170 public virtual string FullName {
173 // FIXME: This is wrong, but it gets us going
174 // in the compiler for now
180 public virtual extern MethodInfo EntryPoint {
181 [MethodImplAttribute (MethodImplOptions.InternalCall)]
185 public virtual Evidence Evidence {
186 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
187 get { return UnprotectedGetEvidence (); }
190 // note: the security runtime requires evidences but may be unable to do so...
191 internal Evidence UnprotectedGetEvidence ()
196 // if the host (runtime) hasn't provided it's own evidence...
197 if (_evidence == null) {
198 // ... we will provide our own
200 _evidence = Evidence.GetDefaultHostEvidence (this);
207 [MethodImplAttribute (MethodImplOptions.InternalCall)]
208 internal extern bool get_global_assembly_cache ();
210 internal bool FromByteArray {
211 set { fromByteArray = value; }
214 public virtual String Location {
219 string loc = get_location ();
221 if ((loc != String.Empty) && SecurityManager.SecurityEnabled) {
222 // we cannot divulge local file informations
223 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, loc).Demand ();
231 public virtual string ImageRuntimeVersion {
233 return InternalImageRuntimeVersion ();
237 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
239 throw new NotImplementedException ();
242 public virtual bool IsDefined (Type attributeType, bool inherit)
244 return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
247 public virtual object [] GetCustomAttributes (bool inherit)
249 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
252 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
254 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
257 [MethodImplAttribute (MethodImplOptions.InternalCall)]
258 private extern object GetFilesInternal (String name, bool getResourceModules);
260 public virtual FileStream[] GetFiles ()
262 return GetFiles (false);
265 public virtual FileStream [] GetFiles (bool getResourceModules)
267 string[] names = (string[]) GetFilesInternal (null, getResourceModules);
269 return EmptyArray<FileStream>.Value;
271 string location = Location;
274 if (location != String.Empty) {
275 res = new FileStream [names.Length + 1];
276 res [0] = new FileStream (location, FileMode.Open, FileAccess.Read);
277 for (int i = 0; i < names.Length; ++i)
278 res [i + 1] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
280 res = new FileStream [names.Length];
281 for (int i = 0; i < names.Length; ++i)
282 res [i] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
287 public virtual FileStream GetFile (String name)
290 throw new ArgumentNullException (null, "Name cannot be null.");
291 if (name.Length == 0)
292 throw new ArgumentException ("Empty name is not valid");
294 string filename = (string)GetFilesInternal (name, true);
295 if (filename != null)
296 return new FileStream (filename, FileMode.Open, FileAccess.Read);
301 [MethodImplAttribute (MethodImplOptions.InternalCall)]
302 internal extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
304 public virtual Stream GetManifestResourceStream (String name)
307 throw new ArgumentNullException ("name");
308 if (name.Length == 0)
309 throw new ArgumentException ("String cannot have zero length.",
312 ManifestResourceInfo info = GetManifestResourceInfo (name);
314 Assembly a = AppDomain.CurrentDomain.DoResourceResolve (name, this);
315 if (a != null && a != this)
316 return a.GetManifestResourceStream (name);
321 if (info.ReferencedAssembly != null)
322 return info.ReferencedAssembly.GetManifestResourceStream (name);
323 if ((info.FileName != null) && (info.ResourceLocation == 0)) {
325 throw new FileNotFoundException (info.FileName);
327 string location = Path.GetDirectoryName (Location);
328 string filename = Path.Combine (location, info.FileName);
329 return new FileStream (filename, FileMode.Open, FileAccess.Read);
334 IntPtr data = GetManifestResourceInternal (name, out size, out module);
335 if (data == (IntPtr) 0)
338 UnmanagedMemoryStream stream;
340 stream = new UnmanagedMemoryStreamForModule ((byte*) data, size, module);
346 public virtual Stream GetManifestResourceStream (Type type, String name)
348 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
349 return GetManifestResourceStream(type, name, false, ref stackMark);
352 internal Stream GetManifestResourceStream (Type type, String name, bool skipSecurityCheck, ref StackCrawlMark stackMark)
354 StringBuilder sb = new StringBuilder ();
357 throw new ArgumentNullException ("type");
359 String nameSpace = type.Namespace;
360 if (nameSpace != null) {
361 sb.Append (nameSpace);
363 sb.Append (Type.Delimiter);
370 return GetManifestResourceStream (sb.ToString());
373 internal unsafe Stream GetManifestResourceStream(String name, ref StackCrawlMark stackMark, bool skipSecurityCheck)
375 return GetManifestResourceStream (null, name, skipSecurityCheck, ref stackMark);
378 internal String GetSimpleName()
380 AssemblyName aname = GetName (true);
384 internal byte[] GetPublicKey()
386 AssemblyName aname = GetName (true);
387 return aname.GetPublicKey ();
390 internal Version GetVersion()
392 AssemblyName aname = GetName (true);
393 return aname.Version;
396 private AssemblyNameFlags GetFlags()
398 AssemblyName aname = GetName (true);
402 [MethodImplAttribute (MethodImplOptions.InternalCall)]
403 internal virtual extern Type[] GetTypes (bool exportedOnly);
405 public virtual Type[] GetTypes ()
407 return GetTypes (false);
410 public virtual Type[] GetExportedTypes ()
412 return GetTypes (true);
415 public virtual Type GetType (String name, Boolean throwOnError)
417 return GetType (name, throwOnError, false);
420 public virtual Type GetType (String name) {
421 return GetType (name, false, false);
424 [MethodImplAttribute (MethodImplOptions.InternalCall)]
425 internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);
427 [MethodImplAttribute (MethodImplOptions.InternalCall)]
428 internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
430 public virtual AssemblyName GetName (Boolean copiedName)
432 throw new NotImplementedException ();
435 public virtual AssemblyName GetName ()
437 return GetName (false);
440 public override string ToString ()
442 // note: ToString work without requiring CodeBase (so no checks are needed)
444 if (assemblyName != null)
447 assemblyName = get_fullname ();
451 public static String CreateQualifiedName (String assemblyName, String typeName)
453 return typeName + ", " + assemblyName;
456 public static Assembly GetAssembly (Type type)
459 return type.Assembly;
460 throw new ArgumentNullException ("type");
464 [MethodImplAttribute (MethodImplOptions.InternalCall)]
465 public static extern Assembly GetEntryAssembly();
467 internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
470 throw new ArgumentNullException("culture");
471 Contract.EndContractBlock();
473 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
474 String name = GetSimpleName() + ".resources";
475 return InternalGetSatelliteAssembly(name, culture, version, true, ref stackMark);
478 internal RuntimeAssembly InternalGetSatelliteAssembly (String name, CultureInfo culture, Version version, bool throwOnFileNotFound, ref StackCrawlMark stackMark)
480 AssemblyName an = new AssemblyName ();
482 an.SetPublicKey (GetPublicKey ());
483 an.Flags = GetFlags () | AssemblyNameFlags.PublicKey;
486 an.Version = GetVersion ();
488 an.Version = version;
490 an.CultureInfo = culture;
496 assembly = AppDomain.CurrentDomain.LoadSatellite (an, false);
497 if (assembly != null)
498 return (RuntimeAssembly)assembly;
499 } catch (FileNotFoundException) {
504 if (String.IsNullOrEmpty (Location))
507 // Try the assembly directory
508 string location = Path.GetDirectoryName (Location);
509 string fullName = Path.Combine (location, Path.Combine (culture.Name, an.Name + ".dll"));
512 return (RuntimeAssembly)LoadFrom (fullName);
514 if (!throwOnFileNotFound && !File.Exists (fullName))
521 Type _Assembly.GetType ()
523 // Required or object::GetType becomes virtual final
524 return base.GetType ();
528 [MethodImplAttribute (MethodImplOptions.InternalCall)]
529 private extern static Assembly LoadFrom (String assemblyFile, bool refonly);
531 public static Assembly LoadFrom (String assemblyFile)
533 return LoadFrom (assemblyFile, false);
537 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
539 Assembly a = LoadFrom (assemblyFile, false);
541 if ((a != null) && (securityEvidence != null)) {
542 // merge evidence (i.e. replace defaults with provided evidences)
543 a.Evidence.Merge (securityEvidence);
550 [MonoTODO("This overload is not currently implemented")]
551 // FIXME: What are we missing?
552 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
554 throw new NotImplementedException ();
558 public static Assembly LoadFrom (String assemblyFile, byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
560 throw new NotImplementedException ();
563 public static Assembly UnsafeLoadFrom (String assemblyFile)
565 return LoadFrom (assemblyFile);
569 public static Assembly LoadFile (String path, Evidence securityEvidence)
572 throw new ArgumentNullException ("path");
573 if (path == String.Empty)
574 throw new ArgumentException ("Path can't be empty", "path");
575 // FIXME: Make this do the right thing
576 return LoadFrom (path, securityEvidence);
579 public static Assembly LoadFile (String path)
581 return LoadFile (path, null);
584 public static Assembly Load (String assemblyString)
586 return AppDomain.CurrentDomain.Load (assemblyString);
590 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
592 return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
595 public static Assembly Load (AssemblyName assemblyRef)
597 return AppDomain.CurrentDomain.Load (assemblyRef);
601 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
603 return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
606 public static Assembly Load (Byte[] rawAssembly)
608 return AppDomain.CurrentDomain.Load (rawAssembly);
611 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
613 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
617 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
618 Evidence securityEvidence)
620 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
623 [MonoLimitation ("Argument securityContextSource is ignored")]
624 public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
626 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
629 public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
631 return AppDomain.CurrentDomain.Load (rawAssembly, null, null, true);
634 public static Assembly ReflectionOnlyLoad (string assemblyString)
636 return AppDomain.CurrentDomain.Load (assemblyString, null, true);
639 public static Assembly ReflectionOnlyLoadFrom (string assemblyFile)
641 if (assemblyFile == null)
642 throw new ArgumentNullException ("assemblyFile");
644 return LoadFrom (assemblyFile, true);
648 public static Assembly LoadWithPartialName (string partialName)
650 return LoadWithPartialName (partialName, null);
653 [MonoTODO ("Not implemented")]
654 public Module LoadModule (string moduleName, byte [] rawModule)
656 throw new NotImplementedException ();
659 [MonoTODO ("Not implemented")]
662 Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
664 throw new NotImplementedException ();
667 [MethodImplAttribute (MethodImplOptions.InternalCall)]
668 private static extern Assembly load_with_partial_name (string name, Evidence e);
671 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
673 return LoadWithPartialName (partialName, securityEvidence, true);
677 * LAMESPEC: It is possible for this method to throw exceptions IF the name supplied
678 * is a valid gac name and contains filesystem entry charachters at the end of the name
679 * ie System/// will throw an exception. However ////System will not as that is canocolized
683 // FIXME: LoadWithPartialName must look cache (no CAS) or read from disk (CAS)
684 internal static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence, bool oldBehavior)
687 throw new NotImplementedException ();
689 if (partialName == null)
690 throw new NullReferenceException ();
692 return load_with_partial_name (partialName, securityEvidence);
695 public Object CreateInstance (String typeName)
697 return CreateInstance (typeName, false);
700 public Object CreateInstance (String typeName, Boolean ignoreCase)
702 Type t = GetType (typeName, false, ignoreCase);
707 return Activator.CreateInstance (t);
708 } catch (InvalidOperationException) {
709 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
715 Object CreateInstance (String typeName, Boolean ignoreCase,
716 BindingFlags bindingAttr, Binder binder,
717 Object[] args, CultureInfo culture,
718 Object[] activationAttributes)
720 Type t = GetType (typeName, false, ignoreCase);
725 return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
726 } catch (InvalidOperationException) {
727 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
731 public Module[] GetLoadedModules ()
733 return GetLoadedModules (false);
736 public Module[] GetModules ()
738 return GetModules (false);
741 [MethodImplAttribute (MethodImplOptions.InternalCall)]
742 internal virtual extern Module[] GetModulesInternal ();
744 [MethodImplAttribute (MethodImplOptions.InternalCall)]
745 public extern virtual String[] GetManifestResourceNames ();
747 [MethodImplAttribute (MethodImplOptions.InternalCall)]
748 public extern static Assembly GetExecutingAssembly ();
750 [MethodImplAttribute (MethodImplOptions.InternalCall)]
751 public extern static Assembly GetCallingAssembly ();
753 [MethodImplAttribute (MethodImplOptions.InternalCall)]
754 internal static extern AssemblyName[] GetReferencedAssemblies (Assembly module);
756 [MethodImplAttribute (MethodImplOptions.InternalCall)]
757 private extern bool GetManifestResourceInfoInternal (String name, ManifestResourceInfo info);
759 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
761 if (resourceName == null)
762 throw new ArgumentNullException ("resourceName");
763 if (resourceName.Length == 0)
764 throw new ArgumentException ("String cannot have zero length.");
765 ManifestResourceInfo result = new ManifestResourceInfo (null, null, 0);
766 bool found = GetManifestResourceInfoInternal (resourceName, result);
773 [MonoTODO ("Currently it always returns zero")]
782 internal virtual Module GetManifestModule () {
783 return GetManifestModuleInternal ();
786 [MethodImplAttribute (MethodImplOptions.InternalCall)]
787 internal extern Module GetManifestModuleInternal ();
790 public virtual extern bool ReflectionOnly {
791 [MethodImplAttribute (MethodImplOptions.InternalCall)]
795 public override int GetHashCode ()
797 return base.GetHashCode ();
800 public override bool Equals (object o)
802 if (((object) this) == o)
808 Assembly other = (Assembly) o;
809 return other._mono_assembly == _mono_assembly;
813 // Code Access Security
815 internal void Resolve ()
818 // FIXME: As we (currently) delay the resolution until the first CAS
819 // Demand it's too late to evaluate the Minimum permission set as a
820 // condition to load the assembly into the AppDomain
821 LoadAssemblyPermissions ();
822 Evidence e = new Evidence (UnprotectedGetEvidence ()); // we need a copy to add PRE
823 e.AddHost (new PermissionRequestEvidence (_minimum, _optional, _refuse));
824 _granted = SecurityManager.ResolvePolicy (e,
825 _minimum, _optional, _refuse, out _denied);
829 internal PermissionSet GrantedPermissionSet {
831 if (_granted == null) {
832 if (SecurityManager.ResolvingPolicyLevel != null) {
833 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
834 return DefaultPolicies.FullTrust;
836 return null; // we can't resolve during resolution
844 internal PermissionSet DeniedPermissionSet {
846 // yes we look for granted, as denied may be null
847 if (_granted == null) {
848 if (SecurityManager.ResolvingPolicyLevel != null) {
849 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
852 return DefaultPolicies.FullTrust; // deny unrestricted
860 [MethodImplAttribute (MethodImplOptions.InternalCall)]
861 extern internal static bool LoadPermissions (Assembly a,
862 ref IntPtr minimum, ref int minLength,
863 ref IntPtr optional, ref int optLength,
864 ref IntPtr refused, ref int refLength);
866 // Support for SecurityAction.RequestMinimum, RequestOptional and RequestRefuse
867 private void LoadAssemblyPermissions ()
869 IntPtr minimum = IntPtr.Zero, optional = IntPtr.Zero, refused = IntPtr.Zero;
870 int minLength = 0, optLength = 0, refLength = 0;
871 if (LoadPermissions (this, ref minimum, ref minLength, ref optional,
872 ref optLength, ref refused, ref refLength)) {
874 // Note: no need to cache these permission sets as they will only be created once
875 // at assembly resolution time.
877 byte[] data = new byte [minLength];
878 Marshal.Copy (minimum, data, 0, minLength);
879 _minimum = SecurityManager.Decode (data);
882 byte[] data = new byte [optLength];
883 Marshal.Copy (optional, data, 0, optLength);
884 _optional = SecurityManager.Decode (data);
887 byte[] data = new byte [refLength];
888 Marshal.Copy (refused, data, 0, refLength);
889 _refuse = SecurityManager.Decode (data);
894 public virtual PermissionSet PermissionSet {
895 get { return this.GrantedPermissionSet; }
898 public virtual SecurityRuleSet SecurityRuleSet {
899 get { throw CreateNIE (); }
904 static Exception CreateNIE ()
906 return new NotImplementedException ("Derived classes must implement it");
909 public virtual IList<CustomAttributeData> GetCustomAttributesData ()
911 return CustomAttributeData.GetCustomAttributes (this);
915 public bool IsFullyTrusted {
919 public virtual Type GetType (string name, bool throwOnError, bool ignoreCase)
924 public virtual Module GetModule (String name)
929 public virtual AssemblyName[] GetReferencedAssemblies ()
934 public virtual Module[] GetModules (bool getResourceModules)
939 [MonoTODO ("Always returns the same as GetModules")]
940 public virtual Module[] GetLoadedModules (bool getResourceModules)
945 public virtual Assembly GetSatelliteAssembly (CultureInfo culture)
950 public virtual Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
955 public virtual Module ManifestModule {
956 get { throw CreateNIE (); }
959 public virtual bool GlobalAssemblyCache {
960 get { throw CreateNIE (); }
963 public virtual bool IsDynamic {
964 get { return false; }
967 public static bool operator == (Assembly left, Assembly right)
969 if ((object)left == (object)right)
971 if ((object)left == null ^ (object)right == null)
973 return left.Equals (right);
976 public static bool operator != (Assembly left, Assembly right)
978 if ((object)left == (object)right)
980 if ((object)left == null ^ (object)right == null)
982 return !left.Equals (right);
985 public virtual IEnumerable<TypeInfo> DefinedTypes {
987 foreach (var type in GetTypes ()) {
988 yield return type.GetTypeInfo ();
993 public virtual IEnumerable<Type> ExportedTypes {
994 get { return GetExportedTypes (); }
997 public virtual IEnumerable<Module> Modules {
998 get { return GetModules (); }
1001 public virtual IEnumerable<CustomAttributeData> CustomAttributes {
1002 get { return GetCustomAttributesData (); }