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 #pragma warning disable 67
62 public event ModuleResolveEventHandler ModuleResolve;
63 #pragma warning restore
66 internal class UnmanagedMemoryStreamForModule : UnmanagedMemoryStream
68 #pragma warning disable 414
70 #pragma warning restore
72 public unsafe UnmanagedMemoryStreamForModule (byte* pointer, long length, Module module)
73 : base (pointer, length)
78 protected override void Dispose (bool disposing)
82 * The returned pointer points inside metadata, so
83 * we have to increase the refcount of the module, and decrease
84 * it when the stream is finalized.
89 base.Dispose (disposing);
93 // Note: changes to fields must be reflected in _MonoReflectionAssembly struct (object-internals.h)
94 #pragma warning disable 649
95 internal IntPtr _mono_assembly;
96 #pragma warning restore 649
98 private ResolveEventHolder resolve_event_holder;
100 private Evidence _evidence;
101 internal PermissionSet _minimum; // for SecurityAction.RequestMinimum
102 internal PermissionSet _optional; // for SecurityAction.RequestOptional
103 internal PermissionSet _refuse; // for SecurityAction.RequestRefuse
104 private PermissionSet _granted; // for the resolved assembly granted permissions
105 private PermissionSet _denied; // for the resolved assembly denied permissions
107 object _evidence, _minimum, _optional, _refuse, _granted, _denied;
109 private bool fromByteArray;
110 private string assemblyName;
115 resolve_event_holder = new ResolveEventHolder ();
119 // We can't store the event directly in this class, since the
120 // compiler would silently insert the fields before _mono_assembly
122 public event ModuleResolveEventHandler ModuleResolve {
123 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
125 resolve_event_holder.ModuleResolve += value;
127 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
129 resolve_event_holder.ModuleResolve -= value;
133 [MethodImplAttribute (MethodImplOptions.InternalCall)]
134 private extern string get_code_base (bool escaped);
136 [MethodImplAttribute (MethodImplOptions.InternalCall)]
137 private extern string get_fullname ();
139 [MethodImplAttribute (MethodImplOptions.InternalCall)]
140 private extern string get_location ();
142 [MethodImplAttribute (MethodImplOptions.InternalCall)]
143 private extern string InternalImageRuntimeVersion ();
145 [MethodImplAttribute (MethodImplOptions.InternalCall)]
146 static internal extern string GetAotId ();
148 // SECURITY: this should be the only caller to icall get_code_base
149 private string GetCodeBase (bool escaped)
151 string cb = get_code_base (escaped);
153 if (SecurityManager.SecurityEnabled) {
154 // we cannot divulge local file informations
155 if (String.Compare ("FILE://", 0, cb, 0, 7, true, CultureInfo.InvariantCulture) == 0) {
156 string file = cb.Substring (7);
157 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, file).Demand ();
164 public virtual string CodeBase {
165 get { return GetCodeBase (false); }
168 public virtual string EscapedCodeBase {
169 get { return GetCodeBase (true); }
172 public virtual string FullName {
175 // FIXME: This is wrong, but it gets us going
176 // in the compiler for now
182 public virtual extern MethodInfo EntryPoint {
183 [MethodImplAttribute (MethodImplOptions.InternalCall)]
187 public virtual Evidence Evidence {
188 [SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
189 get { return UnprotectedGetEvidence (); }
192 // note: the security runtime requires evidences but may be unable to do so...
193 internal Evidence UnprotectedGetEvidence ()
198 // if the host (runtime) hasn't provided it's own evidence...
199 if (_evidence == null) {
200 // ... we will provide our own
202 _evidence = Evidence.GetDefaultHostEvidence (this);
209 [MethodImplAttribute (MethodImplOptions.InternalCall)]
210 internal extern bool get_global_assembly_cache ();
212 internal bool FromByteArray {
213 set { fromByteArray = value; }
216 public virtual String Location {
221 string loc = get_location ();
223 if ((loc != String.Empty) && SecurityManager.SecurityEnabled) {
224 // we cannot divulge local file informations
225 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, loc).Demand ();
233 public virtual string ImageRuntimeVersion {
235 return InternalImageRuntimeVersion ();
239 public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
241 throw new NotImplementedException ();
244 public virtual bool IsDefined (Type attributeType, bool inherit)
246 return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
249 public virtual object [] GetCustomAttributes (bool inherit)
251 return MonoCustomAttrs.GetCustomAttributes (this, inherit);
254 public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
256 return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
259 [MethodImplAttribute (MethodImplOptions.InternalCall)]
260 private extern object GetFilesInternal (String name, bool getResourceModules);
262 public virtual FileStream[] GetFiles ()
264 return GetFiles (false);
267 public virtual FileStream [] GetFiles (bool getResourceModules)
269 string[] names = (string[]) GetFilesInternal (null, getResourceModules);
271 return EmptyArray<FileStream>.Value;
273 string location = Location;
276 if (location != String.Empty) {
277 res = new FileStream [names.Length + 1];
278 res [0] = new FileStream (location, FileMode.Open, FileAccess.Read);
279 for (int i = 0; i < names.Length; ++i)
280 res [i + 1] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
282 res = new FileStream [names.Length];
283 for (int i = 0; i < names.Length; ++i)
284 res [i] = new FileStream (names [i], FileMode.Open, FileAccess.Read);
289 public virtual FileStream GetFile (String name)
292 throw new ArgumentNullException (null, "Name cannot be null.");
293 if (name.Length == 0)
294 throw new ArgumentException ("Empty name is not valid");
296 string filename = (string)GetFilesInternal (name, true);
297 if (filename != null)
298 return new FileStream (filename, FileMode.Open, FileAccess.Read);
303 [MethodImplAttribute (MethodImplOptions.InternalCall)]
304 internal extern IntPtr GetManifestResourceInternal (String name, out int size, out Module module);
306 public virtual Stream GetManifestResourceStream (String name)
309 throw new ArgumentNullException ("name");
310 if (name.Length == 0)
311 throw new ArgumentException ("String cannot have zero length.",
314 ManifestResourceInfo info = GetManifestResourceInfo (name);
316 Assembly a = AppDomain.CurrentDomain.DoResourceResolve (name, this);
317 if (a != null && a != this)
318 return a.GetManifestResourceStream (name);
323 if (info.ReferencedAssembly != null)
324 return info.ReferencedAssembly.GetManifestResourceStream (name);
325 if ((info.FileName != null) && (info.ResourceLocation == 0)) {
327 throw new FileNotFoundException (info.FileName);
329 string location = Path.GetDirectoryName (Location);
330 string filename = Path.Combine (location, info.FileName);
331 return new FileStream (filename, FileMode.Open, FileAccess.Read);
336 IntPtr data = GetManifestResourceInternal (name, out size, out module);
337 if (data == (IntPtr) 0)
340 UnmanagedMemoryStream stream;
342 stream = new UnmanagedMemoryStreamForModule ((byte*) data, size, module);
348 public virtual Stream GetManifestResourceStream (Type type, String name)
350 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
351 return GetManifestResourceStream(type, name, false, ref stackMark);
354 internal Stream GetManifestResourceStream (Type type, String name, bool skipSecurityCheck, ref StackCrawlMark stackMark)
356 StringBuilder sb = new StringBuilder ();
359 throw new ArgumentNullException ("type");
361 String nameSpace = type.Namespace;
362 if (nameSpace != null) {
363 sb.Append (nameSpace);
365 sb.Append (Type.Delimiter);
372 return GetManifestResourceStream (sb.ToString());
375 internal unsafe Stream GetManifestResourceStream(String name, ref StackCrawlMark stackMark, bool skipSecurityCheck)
377 return GetManifestResourceStream (null, name, skipSecurityCheck, ref stackMark);
380 internal String GetSimpleName()
382 AssemblyName aname = GetName (true);
386 internal byte[] GetPublicKey()
388 AssemblyName aname = GetName (true);
389 return aname.GetPublicKey ();
392 internal Version GetVersion()
394 AssemblyName aname = GetName (true);
395 return aname.Version;
398 private AssemblyNameFlags GetFlags()
400 AssemblyName aname = GetName (true);
404 [MethodImplAttribute (MethodImplOptions.InternalCall)]
405 internal virtual extern Type[] GetTypes (bool exportedOnly);
407 public virtual Type[] GetTypes ()
409 return GetTypes (false);
412 public virtual Type[] GetExportedTypes ()
414 return GetTypes (true);
417 public virtual Type GetType (String name, Boolean throwOnError)
419 return GetType (name, throwOnError, false);
422 public virtual Type GetType (String name) {
423 return GetType (name, false, false);
426 [MethodImplAttribute (MethodImplOptions.InternalCall)]
427 internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);
429 [MethodImplAttribute (MethodImplOptions.InternalCall)]
430 internal extern static void InternalGetAssemblyName (string assemblyFile, AssemblyName aname);
432 public virtual AssemblyName GetName (Boolean copiedName)
434 throw new NotImplementedException ();
437 public virtual AssemblyName GetName ()
439 return GetName (false);
442 public override string ToString ()
444 // note: ToString work without requiring CodeBase (so no checks are needed)
446 if (assemblyName != null)
449 assemblyName = get_fullname ();
453 public static String CreateQualifiedName (String assemblyName, String typeName)
455 return typeName + ", " + assemblyName;
458 public static Assembly GetAssembly (Type type)
461 return type.Assembly;
462 throw new ArgumentNullException ("type");
466 [MethodImplAttribute (MethodImplOptions.InternalCall)]
467 public static extern Assembly GetEntryAssembly();
469 internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError)
472 throw new ArgumentNullException("culture");
473 Contract.EndContractBlock();
475 StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
476 String name = GetSimpleName() + ".resources";
477 return InternalGetSatelliteAssembly(name, culture, version, true, ref stackMark);
480 internal RuntimeAssembly InternalGetSatelliteAssembly (String name, CultureInfo culture, Version version, bool throwOnFileNotFound, ref StackCrawlMark stackMark)
482 AssemblyName an = new AssemblyName ();
484 an.SetPublicKey (GetPublicKey ());
485 an.Flags = GetFlags () | AssemblyNameFlags.PublicKey;
488 an.Version = GetVersion ();
490 an.Version = version;
492 an.CultureInfo = culture;
498 assembly = AppDomain.CurrentDomain.LoadSatellite (an, false);
499 if (assembly != null)
500 return (RuntimeAssembly)assembly;
501 } catch (FileNotFoundException) {
506 if (String.IsNullOrEmpty (Location))
509 // Try the assembly directory
510 string location = Path.GetDirectoryName (Location);
511 string fullName = Path.Combine (location, Path.Combine (culture.Name, an.Name + ".dll"));
514 return (RuntimeAssembly)LoadFrom (fullName);
516 if (!throwOnFileNotFound && !File.Exists (fullName))
523 Type _Assembly.GetType ()
525 // Required or object::GetType becomes virtual final
526 return base.GetType ();
530 [MethodImplAttribute (MethodImplOptions.InternalCall)]
531 private extern static Assembly LoadFrom (String assemblyFile, bool refonly);
533 public static Assembly LoadFrom (String assemblyFile)
535 return LoadFrom (assemblyFile, false);
539 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
541 Assembly a = LoadFrom (assemblyFile, false);
543 if ((a != null) && (securityEvidence != null)) {
544 // merge evidence (i.e. replace defaults with provided evidences)
545 a.Evidence.Merge (securityEvidence);
552 [MonoTODO("This overload is not currently implemented")]
553 // FIXME: What are we missing?
554 public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
556 throw new NotImplementedException ();
560 public static Assembly LoadFrom (String assemblyFile, byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
562 throw new NotImplementedException ();
565 public static Assembly UnsafeLoadFrom (String assemblyFile)
567 return LoadFrom (assemblyFile);
571 public static Assembly LoadFile (String path, Evidence securityEvidence)
574 throw new ArgumentNullException ("path");
575 if (path == String.Empty)
576 throw new ArgumentException ("Path can't be empty", "path");
577 // FIXME: Make this do the right thing
578 return LoadFrom (path, securityEvidence);
581 public static Assembly LoadFile (String path)
583 return LoadFile (path, null);
586 public static Assembly Load (String assemblyString)
588 return AppDomain.CurrentDomain.Load (assemblyString);
592 public static Assembly Load (String assemblyString, Evidence assemblySecurity)
594 return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
597 public static Assembly Load (AssemblyName assemblyRef)
599 return AppDomain.CurrentDomain.Load (assemblyRef);
603 public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
605 return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
608 public static Assembly Load (Byte[] rawAssembly)
610 return AppDomain.CurrentDomain.Load (rawAssembly);
613 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
615 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
619 public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
620 Evidence securityEvidence)
622 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
625 [MonoLimitation ("Argument securityContextSource is ignored")]
626 public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
628 return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
631 public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
633 return AppDomain.CurrentDomain.Load (rawAssembly, null, null, true);
636 public static Assembly ReflectionOnlyLoad (string assemblyString)
638 return AppDomain.CurrentDomain.Load (assemblyString, null, true);
641 public static Assembly ReflectionOnlyLoadFrom (string assemblyFile)
643 if (assemblyFile == null)
644 throw new ArgumentNullException ("assemblyFile");
646 return LoadFrom (assemblyFile, true);
650 public static Assembly LoadWithPartialName (string partialName)
652 return LoadWithPartialName (partialName, null);
655 [MonoTODO ("Not implemented")]
656 public Module LoadModule (string moduleName, byte [] rawModule)
658 throw new NotImplementedException ();
661 [MonoTODO ("Not implemented")]
664 Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
666 throw new NotImplementedException ();
669 [MethodImplAttribute (MethodImplOptions.InternalCall)]
670 private static extern Assembly load_with_partial_name (string name, Evidence e);
673 public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
675 return LoadWithPartialName (partialName, securityEvidence, true);
679 * LAMESPEC: It is possible for this method to throw exceptions IF the name supplied
680 * is a valid gac name and contains filesystem entry charachters at the end of the name
681 * ie System/// will throw an exception. However ////System will not as that is canocolized
685 // FIXME: LoadWithPartialName must look cache (no CAS) or read from disk (CAS)
686 internal static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence, bool oldBehavior)
689 throw new NotImplementedException ();
691 if (partialName == null)
692 throw new NullReferenceException ();
694 return load_with_partial_name (partialName, securityEvidence);
697 public Object CreateInstance (String typeName)
699 return CreateInstance (typeName, false);
702 public Object CreateInstance (String typeName, Boolean ignoreCase)
704 Type t = GetType (typeName, false, ignoreCase);
709 return Activator.CreateInstance (t);
710 } catch (InvalidOperationException) {
711 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
717 Object CreateInstance (String typeName, Boolean ignoreCase,
718 BindingFlags bindingAttr, Binder binder,
719 Object[] args, CultureInfo culture,
720 Object[] activationAttributes)
722 Type t = GetType (typeName, false, ignoreCase);
727 return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
728 } catch (InvalidOperationException) {
729 throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
733 public Module[] GetLoadedModules ()
735 return GetLoadedModules (false);
738 public Module[] GetModules ()
740 return GetModules (false);
743 [MethodImplAttribute (MethodImplOptions.InternalCall)]
744 internal virtual extern Module[] GetModulesInternal ();
746 [MethodImplAttribute (MethodImplOptions.InternalCall)]
747 public extern virtual String[] GetManifestResourceNames ();
749 [MethodImplAttribute (MethodImplOptions.InternalCall)]
750 public extern static Assembly GetExecutingAssembly ();
752 [MethodImplAttribute (MethodImplOptions.InternalCall)]
753 public extern static Assembly GetCallingAssembly ();
755 [MethodImplAttribute (MethodImplOptions.InternalCall)]
756 internal static extern AssemblyName[] GetReferencedAssemblies (Assembly module);
758 [MethodImplAttribute (MethodImplOptions.InternalCall)]
759 private extern bool GetManifestResourceInfoInternal (String name, ManifestResourceInfo info);
761 public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
763 if (resourceName == null)
764 throw new ArgumentNullException ("resourceName");
765 if (resourceName.Length == 0)
766 throw new ArgumentException ("String cannot have zero length.");
767 ManifestResourceInfo result = new ManifestResourceInfo (null, null, 0);
768 bool found = GetManifestResourceInfoInternal (resourceName, result);
775 [MonoTODO ("Currently it always returns zero")]
784 internal virtual Module GetManifestModule () {
785 return GetManifestModuleInternal ();
788 [MethodImplAttribute (MethodImplOptions.InternalCall)]
789 internal extern Module GetManifestModuleInternal ();
792 public virtual extern bool ReflectionOnly {
793 [MethodImplAttribute (MethodImplOptions.InternalCall)]
797 public override int GetHashCode ()
799 return base.GetHashCode ();
802 public override bool Equals (object o)
804 if (((object) this) == o)
810 Assembly other = (Assembly) o;
811 return other._mono_assembly == _mono_assembly;
815 // Code Access Security
817 internal void Resolve ()
820 // FIXME: As we (currently) delay the resolution until the first CAS
821 // Demand it's too late to evaluate the Minimum permission set as a
822 // condition to load the assembly into the AppDomain
823 LoadAssemblyPermissions ();
824 Evidence e = new Evidence (UnprotectedGetEvidence ()); // we need a copy to add PRE
825 e.AddHost (new PermissionRequestEvidence (_minimum, _optional, _refuse));
826 _granted = SecurityManager.ResolvePolicy (e,
827 _minimum, _optional, _refuse, out _denied);
831 internal PermissionSet GrantedPermissionSet {
833 if (_granted == null) {
834 if (SecurityManager.ResolvingPolicyLevel != null) {
835 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
836 return DefaultPolicies.FullTrust;
838 return null; // we can't resolve during resolution
846 internal PermissionSet DeniedPermissionSet {
848 // yes we look for granted, as denied may be null
849 if (_granted == null) {
850 if (SecurityManager.ResolvingPolicyLevel != null) {
851 if (SecurityManager.ResolvingPolicyLevel.IsFullTrustAssembly (this))
854 return DefaultPolicies.FullTrust; // deny unrestricted
862 [MethodImplAttribute (MethodImplOptions.InternalCall)]
863 extern internal static bool LoadPermissions (Assembly a,
864 ref IntPtr minimum, ref int minLength,
865 ref IntPtr optional, ref int optLength,
866 ref IntPtr refused, ref int refLength);
868 // Support for SecurityAction.RequestMinimum, RequestOptional and RequestRefuse
869 private void LoadAssemblyPermissions ()
871 IntPtr minimum = IntPtr.Zero, optional = IntPtr.Zero, refused = IntPtr.Zero;
872 int minLength = 0, optLength = 0, refLength = 0;
873 if (LoadPermissions (this, ref minimum, ref minLength, ref optional,
874 ref optLength, ref refused, ref refLength)) {
876 // Note: no need to cache these permission sets as they will only be created once
877 // at assembly resolution time.
879 byte[] data = new byte [minLength];
880 Marshal.Copy (minimum, data, 0, minLength);
881 _minimum = SecurityManager.Decode (data);
884 byte[] data = new byte [optLength];
885 Marshal.Copy (optional, data, 0, optLength);
886 _optional = SecurityManager.Decode (data);
889 byte[] data = new byte [refLength];
890 Marshal.Copy (refused, data, 0, refLength);
891 _refuse = SecurityManager.Decode (data);
896 public virtual PermissionSet PermissionSet {
897 get { return this.GrantedPermissionSet; }
900 public virtual SecurityRuleSet SecurityRuleSet {
901 get { throw CreateNIE (); }
906 static Exception CreateNIE ()
908 return new NotImplementedException ("Derived classes must implement it");
911 public virtual IList<CustomAttributeData> GetCustomAttributesData ()
913 return CustomAttributeData.GetCustomAttributes (this);
917 public bool IsFullyTrusted {
921 public virtual Type GetType (string name, bool throwOnError, bool ignoreCase)
926 public virtual Module GetModule (String name)
931 public virtual AssemblyName[] GetReferencedAssemblies ()
936 public virtual Module[] GetModules (bool getResourceModules)
941 [MonoTODO ("Always returns the same as GetModules")]
942 public virtual Module[] GetLoadedModules (bool getResourceModules)
947 public virtual Assembly GetSatelliteAssembly (CultureInfo culture)
952 public virtual Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
957 public virtual Module ManifestModule {
958 get { throw CreateNIE (); }
961 public virtual bool GlobalAssemblyCache {
962 get { throw CreateNIE (); }
965 public virtual bool IsDynamic {
966 get { return false; }
969 public static bool operator == (Assembly left, Assembly right)
971 if ((object)left == (object)right)
973 if ((object)left == null ^ (object)right == null)
975 return left.Equals (right);
978 public static bool operator != (Assembly left, Assembly right)
980 if ((object)left == (object)right)
982 if ((object)left == null ^ (object)right == null)
984 return !left.Equals (right);
987 public virtual IEnumerable<TypeInfo> DefinedTypes {
989 foreach (var type in GetTypes ()) {
990 yield return type.GetTypeInfo ();
995 public virtual IEnumerable<Type> ExportedTypes {
996 get { return GetExportedTypes (); }
999 public virtual IEnumerable<Module> Modules {
1000 get { return GetModules (); }
1003 public virtual IEnumerable<CustomAttributeData> CustomAttributes {
1004 get { return GetCustomAttributesData (); }