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
68 public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
69 : base (pointer, length)
74 protected override void Dispose (bool disposing)
78 * The returned pointer points inside metadata, so
79 * we have to increase the refcount of the module, and decrease
80 * it when the stream is finalized.
85 base.Dispose (disposing);
89 // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
90 #pragma warning disable 649
91 private IntPtr _mono_assembly;
92 #pragma warning restore 649
94 private ResolveEventHolder resolve_event_holder;
96 private Evidence _evidence;
97 internal PermissionSet _minimum; // for SecurityAction.RequestMinimum
98 internal PermissionSet _optional; // for SecurityAction.RequestOptional
99 internal PermissionSet _refuse; // for SecurityAction.RequestRefuse
100 private PermissionSet _granted; // for the resolved assembly granted permissions
101 private PermissionSet _denied; // for the resolved assembly denied permissions
103 object _evidence, _minimum, _optional, _refuse, _granted, _denied;
105 private bool fromByteArray;
106 private string assemblyName;
111 resolve_event_holder = new ResolveEventHolder ();
115 // We can't store the event directly in this class, since the
116 // compiler would silently insert the fields before _mono_assembly
118 public event ModuleResolveEventHandler ModuleResolve {
119 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
121 resolve_event_holder.ModuleResolve += value;
123 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
125 resolve_event_holder.ModuleResolve -= value;
129 [MethodImplAttribute (MethodImplOptions.InternalCall)]
130 private extern string get_code_base (bool escaped);
132 [MethodImplAttribute (MethodImplOptions.InternalCall)]
133 private extern string get_fullname ();
135 [MethodImplAttribute (MethodImplOptions.InternalCall)]
136 private extern string get_location ();
138 [MethodImplAttribute (MethodImplOptions.InternalCall)]
139 private extern string InternalImageRuntimeVersion ();
141 [MethodImplAttribute (MethodImplOptions.InternalCall)]
142 static internal extern string GetAotId ();
144 // SECURITY: this should be the only caller to icall get_code_base
145 private string GetCodeBase (bool escaped)
147 string cb = get_code_base (escaped);
149 if (SecurityManager.SecurityEnabled) {
150 // we cannot divulge local file informations
151 if (String.Compare ("FILE://", 0, cb, 0, 7, true, CultureInfo.InvariantCulture) == 0) {
152 string file = cb.Substring (7);
153 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, file).Demand ();
160 public virtual string CodeBase {
161 get { return GetCodeBase (false); }
164 public virtual string EscapedCodeBase {
165 get { return GetCodeBase (true); }
168 public virtual string FullName {
171 // FIXME: This is wrong, but it gets us going
172 // in the compiler for now
178 public virtual extern MethodInfo EntryPoint {
179 [MethodImplAttribute (MethodImplOptions.InternalCall)]
183 public virtual Evidence Evidence {
184 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
185 get { return UnprotectedGetEvidence (); }
188 // note: the security runtime requires evidences but may be unable to do so...
189 internal Evidence UnprotectedGetEvidence ()
194 // if the host (runtime) hasn't provided it's own evidence...
195 if (_evidence == null) {
196 // ... we will provide our own
198 _evidence = Evidence.GetDefaultHostEvidence (this);
205 [MethodImplAttribute (MethodImplOptions.InternalCall)]
206 internal extern bool get_global_assembly_cache ();
208 internal bool FromByteArray {
209 set { fromByteArray = value; }
212 public virtual String Location {
217 string loc = get_location ();
219 if ((loc != String.Empty) && SecurityManager.SecurityEnabled) {
220 // we cannot divulge local file informations
221 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, loc).Demand ();
229 public virtual string ImageRuntimeVersion {
231 return InternalImageRuntimeVersion ();
235 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
237 throw new NotImplementedException ();
240 public virtual bool IsDefined (Type attributeType, bool inherit)
242 return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
245 public virtual object [] GetCustomAttributes (bool inherit)
247 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
250 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
252 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
255 [MethodImplAttribute (MethodImplOptions.InternalCall)]
256 private extern object GetFilesInternal (String name, bool getResourceModules);
258 public virtual FileStream[] GetFiles ()
260 return GetFiles (false);
263 public virtual FileStream [] GetFiles (bool getResourceModules)
265 string[] names = (string[]) GetFilesInternal (null, getResourceModules);
267 return EmptyArray<FileStream>.Value;
269 string location = Location;
272 if (location != String.Empty) {
273 res = new FileStream [names.Length + 1];
274 res [0] = new FileStream (location, FileMode.Open, FileAccess.Read);
275 for (int i = 0; i < names.Length; ++i)
276 res [i + 1] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
278 res = new FileStream [names.Length];
279 for (int i = 0; i < names.Length; ++i)
280 res [i] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
285 public virtual FileStream GetFile (String name)
288 throw new ArgumentNullException (null, "Name cannot be null.");
289 if (name.Length == 0)
290 throw new ArgumentException ("Empty name is not valid");
292 string filename = (string)GetFilesInternal (name, true);
293 if (filename != null)
294 return new FileStream (filename, FileMode.Open, FileAccess.Read);
299 [MethodImplAttribute (MethodImplOptions.InternalCall)]
300 internal extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
302 public virtual Stream GetManifestResourceStream (String name)
305 throw new ArgumentNullException ("name");
306 if (name.Length == 0)
307 throw new ArgumentException ("String cannot have zero length.",
310 ManifestResourceInfo info = GetManifestResourceInfo (name);
312 Assembly a = AppDomain.CurrentDomain.DoResourceResolve (name, this);
313 if (a != null && a != this)
314 return a.GetManifestResourceStream (name);
319 if (info.ReferencedAssembly != null)
320 return info.ReferencedAssembly.GetManifestResourceStream (name);
321 if ((info.FileName != null) && (info.ResourceLocation == 0)) {
323 throw new FileNotFoundException (info.FileName);
325 string location = Path.GetDirectoryName (Location);
326 string filename = Path.Combine (location, info.FileName);
327 return new FileStream (filename, FileMode.Open, FileAccess.Read);
332 IntPtr data = GetManifestResourceInternal (name, out size, out module);
333 if (data == (IntPtr) 0)
336 UnmanagedMemoryStream stream;
338 stream = new UnmanagedMemoryStreamForModule ((byte*) data, size, module);
344 public virtual Stream GetManifestResourceStream (Type type, String name)
346 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
347 return GetManifestResourceStream(type, name, false, ref stackMark);
350 internal Stream GetManifestResourceStream (Type type, String name, bool skipSecurityCheck, ref StackCrawlMark stackMark)
352 StringBuilder sb = new StringBuilder ();
355 throw new ArgumentNullException ("type");
357 String nameSpace = type.Namespace;
358 if (nameSpace != null) {
359 sb.Append (nameSpace);
361 sb.Append (Type.Delimiter);
368 return GetManifestResourceStream (sb.ToString());
371 internal unsafe Stream GetManifestResourceStream(String name, ref StackCrawlMark stackMark, bool skipSecurityCheck)
373 return GetManifestResourceStream (null, name, skipSecurityCheck, ref stackMark);
376 internal String GetSimpleName()
378 AssemblyName aname = GetName (true);
382 internal byte[] GetPublicKey()
384 AssemblyName aname = GetName (true);
385 return aname.GetPublicKey ();
388 internal Version GetVersion()
390 AssemblyName aname = GetName (true);
391 return aname.Version;
394 private AssemblyNameFlags GetFlags()
396 AssemblyName aname = GetName (true);
400 [MethodImplAttribute (MethodImplOptions.InternalCall)]
401 internal virtual extern Type[] GetTypes (bool exportedOnly);
403 public virtual Type[] GetTypes ()
405 return GetTypes (false);
408 public virtual Type[] GetExportedTypes ()
410 return GetTypes (true);
413 public virtual Type GetType (String name, Boolean throwOnError)
415 return GetType (name, throwOnError, false);
418 public virtual Type GetType (String name) {
419 return GetType (name, false, false);
422 [MethodImplAttribute (MethodImplOptions.InternalCall)]
423 internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);
425 [MethodImplAttribute (MethodImplOptions.InternalCall)]
426 internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
428 [MethodImplAttribute (MethodImplOptions.InternalCall)]
429 static extern internal void FillName (Assembly ass, AssemblyName aname);
431 public virtual AssemblyName GetName (Boolean copiedName)
433 throw new NotImplementedException ();
436 public virtual AssemblyName GetName ()
438 return GetName (false);
441 public override string ToString ()
443 // note: ToString work without requiring CodeBase (so no checks are needed)
445 if (assemblyName != null)
448 assemblyName = get_fullname ();
452 public static String CreateQualifiedName (String assemblyName, String typeName)
454 return typeName + ", " + assemblyName;
457 public static Assembly GetAssembly (Type type)
460 return type.Assembly;
461 throw new ArgumentNullException ("type");
465 [MethodImplAttribute (MethodImplOptions.InternalCall)]
466 public static extern Assembly GetEntryAssembly();
468 internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
471 throw new ArgumentNullException("culture");
472 Contract.EndContractBlock();
474 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
475 String name = GetSimpleName() + ".resources";
476 return InternalGetSatelliteAssembly(name, culture, version, true, ref stackMark);
479 internal RuntimeAssembly InternalGetSatelliteAssembly (String name, CultureInfo culture, Version version, bool throwOnFileNotFound, ref StackCrawlMark stackMark)
481 AssemblyName an = new AssemblyName ();
483 an.SetPublicKey (GetPublicKey ());
484 an.Flags = GetFlags () | AssemblyNameFlags.PublicKey;
487 an.Version = GetVersion ();
489 an.Version = version;
491 an.CultureInfo = culture;
497 assembly = AppDomain.CurrentDomain.LoadSatellite (an, false);
498 if (assembly != null)
499 return (RuntimeAssembly)assembly;
500 } catch (FileNotFoundException) {
505 if (String.IsNullOrEmpty (Location))
508 // Try the assembly directory
509 string location = Path.GetDirectoryName (Location);
510 string fullName = Path.Combine (location, Path.Combine (culture.Name, an.Name + ".dll"));
511 if (!throwOnFileNotFound && !File.Exists (fullName))
514 return (RuntimeAssembly)LoadFrom (fullName);
518 Type _Assembly.GetType ()
520 // Required or object::GetType becomes virtual final
521 return base.GetType ();
525 [MethodImplAttribute (MethodImplOptions.InternalCall)]
526 private extern static Assembly LoadFrom (String assemblyFile, bool refonly);
528 public static Assembly LoadFrom (String assemblyFile)
530 return LoadFrom (assemblyFile, false);
534 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
536 Assembly a = LoadFrom (assemblyFile, false);
538 if ((a != null) && (securityEvidence != null)) {
539 // merge evidence (i.e. replace defaults with provided evidences)
540 a.Evidence.Merge (securityEvidence);
547 [MonoTODO("This overload is not currently implemented")]
548 // FIXME: What are we missing?
549 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
551 throw new NotImplementedException ();
555 public static Assembly LoadFrom (String assemblyFile, byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
557 throw new NotImplementedException ();
560 public static Assembly UnsafeLoadFrom (String assemblyFile)
562 return LoadFrom (assemblyFile);
566 public static Assembly LoadFile (String path, Evidence securityEvidence)
569 throw new ArgumentNullException ("path");
570 if (path == String.Empty)
571 throw new ArgumentException ("Path can't be empty", "path");
572 // FIXME: Make this do the right thing
573 return LoadFrom (path, securityEvidence);
576 public static Assembly LoadFile (String path)
578 return LoadFile (path, null);
581 public static Assembly Load (String assemblyString)
583 return AppDomain.CurrentDomain.Load (assemblyString);
587 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
589 return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
592 public static Assembly Load (AssemblyName assemblyRef)
594 return AppDomain.CurrentDomain.Load (assemblyRef);
598 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
600 return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
603 public static Assembly Load (Byte[] rawAssembly)
605 return AppDomain.CurrentDomain.Load (rawAssembly);
608 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
610 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
614 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
615 Evidence securityEvidence)
617 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
620 [MonoLimitation ("Argument securityContextSource is ignored")]
621 public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
623 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
626 public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
628 return AppDomain.CurrentDomain.Load (rawAssembly, null, null, true);
631 public static Assembly ReflectionOnlyLoad (string assemblyString)
633 return AppDomain.CurrentDomain.Load (assemblyString, null, true);
636 public static Assembly ReflectionOnlyLoadFrom (string assemblyFile)
638 if (assemblyFile == null)
639 throw new ArgumentNullException ("assemblyFile");
641 return LoadFrom (assemblyFile, true);
645 public static Assembly LoadWithPartialName (string partialName)
647 return LoadWithPartialName (partialName, null);
650 [MonoTODO ("Not implemented")]
651 public Module LoadModule (string moduleName, byte [] rawModule)
653 throw new NotImplementedException ();
656 [MonoTODO ("Not implemented")]
659 Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
661 throw new NotImplementedException ();
664 [MethodImplAttribute (MethodImplOptions.InternalCall)]
665 private static extern Assembly load_with_partial_name (string name, Evidence e);
668 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
670 return LoadWithPartialName (partialName, securityEvidence, true);
674 * LAMESPEC: It is possible for this method to throw exceptions IF the name supplied
675 * is a valid gac name and contains filesystem entry charachters at the end of the name
676 * ie System/// will throw an exception. However ////System will not as that is canocolized
680 // FIXME: LoadWithPartialName must look cache (no CAS) or read from disk (CAS)
681 internal static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence, bool oldBehavior)
684 throw new NotImplementedException ();
686 if (partialName == null)
687 throw new NullReferenceException ();
689 return load_with_partial_name (partialName, securityEvidence);
692 public Object CreateInstance (String typeName)
694 return CreateInstance (typeName, false);
697 public Object CreateInstance (String typeName, Boolean ignoreCase)
699 Type t = GetType (typeName, false, ignoreCase);
704 return Activator.CreateInstance (t);
705 } catch (InvalidOperationException) {
706 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
712 Object CreateInstance (String typeName, Boolean ignoreCase,
713 BindingFlags bindingAttr, Binder binder,
714 Object[] args, CultureInfo culture,
715 Object[] activationAttributes)
717 Type t = GetType (typeName, false, ignoreCase);
722 return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
723 } catch (InvalidOperationException) {
724 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
728 public Module[] GetLoadedModules ()
730 return GetLoadedModules (false);
733 public Module[] GetModules ()
735 return GetModules (false);
738 [MethodImplAttribute (MethodImplOptions.InternalCall)]
739 internal virtual extern Module[] GetModulesInternal ();
741 [MethodImplAttribute (MethodImplOptions.InternalCall)]
742 public extern virtual String[] GetManifestResourceNames ();
744 [MethodImplAttribute (MethodImplOptions.InternalCall)]
745 public extern static Assembly GetExecutingAssembly ();
747 [MethodImplAttribute (MethodImplOptions.InternalCall)]
748 public extern static Assembly GetCallingAssembly ();
750 [MethodImplAttribute (MethodImplOptions.InternalCall)]
751 internal static extern AssemblyName[] GetReferencedAssemblies (Assembly module);
753 [MethodImplAttribute (MethodImplOptions.InternalCall)]
754 private extern bool GetManifestResourceInfoInternal (String name, ManifestResourceInfo info);
756 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
758 if (resourceName == null)
759 throw new ArgumentNullException ("resourceName");
760 if (resourceName.Length == 0)
761 throw new ArgumentException ("String cannot have zero length.");
762 ManifestResourceInfo result = new ManifestResourceInfo (null, null, 0);
763 bool found = GetManifestResourceInfoInternal (resourceName, result);
770 [MonoTODO ("Currently it always returns zero")]
779 internal virtual Module GetManifestModule () {
780 return GetManifestModuleInternal ();
783 [MethodImplAttribute (MethodImplOptions.InternalCall)]
784 internal extern Module GetManifestModuleInternal ();
787 public virtual extern bool ReflectionOnly {
788 [MethodImplAttribute (MethodImplOptions.InternalCall)]
792 public override int GetHashCode ()
794 return base.GetHashCode ();
797 public override bool Equals (object o)
799 if (((object) this) == o)
805 Assembly other = (Assembly) o;
806 return other._mono_assembly == _mono_assembly;
810 // Code Access Security
812 internal void Resolve ()
815 // FIXME: As we (currently) delay the resolution until the first CAS
816 // Demand it's too late to evaluate the Minimum permission set as a
817 // condition to load the assembly into the AppDomain
818 LoadAssemblyPermissions ();
819 Evidence e = new Evidence (UnprotectedGetEvidence ()); // we need a copy to add PRE
820 e.AddHost (new PermissionRequestEvidence (_minimum, _optional, _refuse));
821 _granted = SecurityManager.ResolvePolicy (e,
822 _minimum, _optional, _refuse, out _denied);
826 internal PermissionSet GrantedPermissionSet {
828 if (_granted == null) {
829 if (SecurityManager.ResolvingPolicyLevel != null) {
830 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
831 return DefaultPolicies.FullTrust;
833 return null; // we can't resolve during resolution
841 internal PermissionSet DeniedPermissionSet {
843 // yes we look for granted, as denied may be null
844 if (_granted == null) {
845 if (SecurityManager.ResolvingPolicyLevel != null) {
846 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
849 return DefaultPolicies.FullTrust; // deny unrestricted
857 [MethodImplAttribute (MethodImplOptions.InternalCall)]
858 extern internal static bool LoadPermissions (Assembly a,
859 ref IntPtr minimum, ref int minLength,
860 ref IntPtr optional, ref int optLength,
861 ref IntPtr refused, ref int refLength);
863 // Support for SecurityAction.RequestMinimum, RequestOptional and RequestRefuse
864 private void LoadAssemblyPermissions ()
866 IntPtr minimum = IntPtr.Zero, optional = IntPtr.Zero, refused = IntPtr.Zero;
867 int minLength = 0, optLength = 0, refLength = 0;
868 if (LoadPermissions (this, ref minimum, ref minLength, ref optional,
869 ref optLength, ref refused, ref refLength)) {
871 // Note: no need to cache these permission sets as they will only be created once
872 // at assembly resolution time.
874 byte[] data = new byte [minLength];
875 Marshal.Copy (minimum, data, 0, minLength);
876 _minimum = SecurityManager.Decode (data);
879 byte[] data = new byte [optLength];
880 Marshal.Copy (optional, data, 0, optLength);
881 _optional = SecurityManager.Decode (data);
884 byte[] data = new byte [refLength];
885 Marshal.Copy (refused, data, 0, refLength);
886 _refuse = SecurityManager.Decode (data);
891 public virtual PermissionSet PermissionSet {
892 get { return this.GrantedPermissionSet; }
895 public virtual SecurityRuleSet SecurityRuleSet {
896 get { throw CreateNIE (); }
901 static Exception CreateNIE ()
903 return new NotImplementedException ("Derived classes must implement it");
906 public virtual IList<CustomAttributeData> GetCustomAttributesData ()
908 return CustomAttributeData.GetCustomAttributes (this);
912 public bool IsFullyTrusted {
916 public virtual Type GetType (string name, bool throwOnError, bool ignoreCase)
921 public virtual Module GetModule (String name)
926 public virtual AssemblyName[] GetReferencedAssemblies ()
931 public virtual Module[] GetModules (bool getResourceModules)
936 [MonoTODO ("Always returns the same as GetModules")]
937 public virtual Module[] GetLoadedModules (bool getResourceModules)
942 public virtual Assembly GetSatelliteAssembly (CultureInfo culture)
947 public virtual Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
952 public virtual Module ManifestModule {
953 get { throw CreateNIE (); }
956 public virtual bool GlobalAssemblyCache {
957 get { throw CreateNIE (); }
960 public virtual bool IsDynamic {
961 get { return false; }
964 public static bool operator == (Assembly left, Assembly right)
966 if ((object)left == (object)right)
968 if ((object)left == null ^ (object)right == null)
970 return left.Equals (right);
973 public static bool operator != (Assembly left, Assembly right)
975 if ((object)left == (object)right)
977 if ((object)left == null ^ (object)right == null)
979 return !left.Equals (right);
982 public virtual IEnumerable<TypeInfo> DefinedTypes {
984 foreach (var type in GetTypes ()) {
985 yield return type.GetTypeInfo ();
990 public virtual IEnumerable<Type> ExportedTypes {
991 get { return GetExportedTypes (); }
994 public virtual IEnumerable<Module> Modules {
995 get { return GetModules (); }
998 public virtual IEnumerable<CustomAttributeData> CustomAttributes {
999 get { return GetCustomAttributesData (); }