File: Assembly.cs

package info (click to toggle)
mono 6.8.0.105%2Bdfsg-3.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,284,512 kB
  • sloc: cs: 11,172,132; xml: 2,850,069; ansic: 671,653; cpp: 122,091; perl: 59,366; javascript: 30,841; asm: 22,168; makefile: 20,093; sh: 15,020; python: 4,827; pascal: 925; sql: 859; sed: 16; php: 1
file content (797 lines) | stat: -rw-r--r-- 22,298 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
//
// System.Reflection/Assembly.cs
//
// Author:
//   Paolo Molaro (lupus@ximian.com)
//
// (C) 2001 Ximian, Inc.  http://www.ximian.com
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
// 
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

using System.Security;
using System.Security.Policy;
using System.Security.Permissions;
using System.Runtime.Serialization;
using System.Reflection;
using System.IO;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Configuration.Assemblies;
using System.Threading;
using System.Text;
using System.Diagnostics.Contracts;

using Mono.Security;

namespace System.Reflection {

	[ComVisible (true)]
	[ComDefaultInterfaceAttribute (typeof (_Assembly))]
	[Serializable]
	[ClassInterface(ClassInterfaceType.None)]
	[StructLayout (LayoutKind.Sequential)]
#if MOBILE
	public partial class Assembly : ICustomAttributeProvider, ISerializable
#else
	public abstract class Assembly : ICustomAttributeProvider, _Assembly, IEvidenceFactory, ISerializable
#endif
	{
		internal class ResolveEventHolder {	
#pragma warning disable 67
			public event ModuleResolveEventHandler ModuleResolve;
#pragma warning restore
		}

		//
		// We can't store the event directly in this class, since the
		// compiler would silently insert the fields before _mono_assembly
		//
		public virtual event ModuleResolveEventHandler ModuleResolve {
			[SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
			add {
				throw new NotImplementedException ();
			}
			[SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
			remove {
				throw new NotImplementedException ();
			}
		}

		public virtual string CodeBase {
			get {
				throw new NotImplementedException ();
			}
		}

		public virtual string EscapedCodeBase {
			get {
				throw new NotImplementedException ();
			}
		}

		public virtual string FullName {
			get {
				throw new NotImplementedException ();
			}
		}

		public virtual MethodInfo EntryPoint {
			get {
				throw new NotImplementedException ();
			}
		}

		public virtual Evidence Evidence {
			[SecurityPermission (SecurityAction.Demand, ControlEvidence = true)]
			get {
				throw new NotImplementedException ();
			}
		}

		internal virtual Evidence UnprotectedGetEvidence ()
		{
			throw new NotImplementedException ();
		}

		internal virtual IntPtr MonoAssembly {
			get {
				throw new NotImplementedException ();
			}
		}

		internal virtual bool FromByteArray {
			set {
				throw new NotImplementedException ();
			}
		}

		public virtual String Location {
			get {
				throw new NotImplementedException ();
			}
		}

		[ComVisible (false)]
		public virtual string ImageRuntimeVersion {
			get {
				throw new NotImplementedException ();
			}
		}

		public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
		{
			throw new NotImplementedException ();
		}

		public virtual bool IsDefined (Type attributeType, bool inherit)
		{
			throw new NotImplementedException ();
		}

		public virtual object [] GetCustomAttributes (bool inherit)
		{
			throw new NotImplementedException ();
		}

		public virtual object [] GetCustomAttributes (Type attributeType, bool inherit)
		{
			throw new NotImplementedException ();
		}

		public virtual FileStream[] GetFiles ()
		{
			return GetFiles (false);
		}

		public virtual FileStream [] GetFiles (bool getResourceModules)
		{
			throw new NotImplementedException ();
		}

		public virtual FileStream GetFile (String name)
		{
			throw new NotImplementedException ();
		}

		public virtual Stream GetManifestResourceStream (String name)
		{
			throw new NotImplementedException ();
		}

		public virtual Stream GetManifestResourceStream (Type type, String name)
		{
			throw new NotImplementedException ();
		}

		internal Stream GetManifestResourceStream (Type type, String name, bool skipSecurityCheck, ref StackCrawlMark stackMark)
		{
			StringBuilder sb = new StringBuilder ();
			if (type == null) {
				if (name == null)
						throw new ArgumentNullException ("type");
			} else {
				String nameSpace = type.Namespace;
				if (nameSpace != null) {
					sb.Append (nameSpace);
					if (name != null)
						sb.Append (Type.Delimiter);
				}
			}

			if (name != null)
				sb.Append(name);

			return GetManifestResourceStream (sb.ToString());
		}

		internal unsafe Stream GetManifestResourceStream(String name, ref StackCrawlMark stackMark, bool skipSecurityCheck)
		{
			return GetManifestResourceStream (null, name, skipSecurityCheck, ref stackMark);
		}

		internal String GetSimpleName()
		{
			AssemblyName aname = GetName (true);
			return aname.Name;
		}

		internal byte[] GetPublicKey()
		{
			AssemblyName aname = GetName (true);
			return aname.GetPublicKey ();
		}

		internal Version GetVersion()
		{
			AssemblyName aname = GetName (true);
			return aname.Version;
		}

		private AssemblyNameFlags GetFlags()
		{
			AssemblyName aname = GetName (true);
			return aname.Flags;
		}

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		internal virtual extern Type[] GetTypes (bool exportedOnly);
		
		public virtual Type[] GetTypes ()
		{
			return GetTypes (false);
		}

		public virtual Type[] GetExportedTypes ()
		{
			throw new NotImplementedException ();
		}

		public virtual Type GetType (String name, Boolean throwOnError)
		{
			return GetType (name, throwOnError, false);
		}

		public virtual Type GetType (String name) {
			return GetType (name, false, false);
		}

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		internal extern Type InternalGetType (Module module, String name, Boolean throwOnError, Boolean ignoreCase);

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		internal extern unsafe static void InternalGetAssemblyName (string assemblyFile, out Mono.MonoAssemblyName aname, out string codebase);

		public virtual AssemblyName GetName (Boolean copiedName)
		{
			throw new NotImplementedException ();
		}

		public virtual AssemblyName GetName ()
		{
			return GetName (false);
		}

		public override string ToString ()
		{
			return base.ToString ();
		}

		public static String CreateQualifiedName (String assemblyName, String typeName) 
		{
			return typeName + ", " + assemblyName;
		}

		public static Assembly GetAssembly (Type type)
		{
			if (type != null)
				return type.Assembly;
			throw new ArgumentNullException ("type");
		}


		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		public static extern Assembly GetEntryAssembly();

		internal Assembly GetSatelliteAssembly (CultureInfo culture, Version version, bool throwOnError, ref StackCrawlMark stackMark)
		{
			if (culture == null)
				throw new ArgumentNullException("culture");
			Contract.EndContractBlock();

			String name = GetSimpleName() + ".resources";
			return InternalGetSatelliteAssembly(name, culture, version, true, ref stackMark);
		}

		internal RuntimeAssembly InternalGetSatelliteAssembly (String name, CultureInfo culture, Version version, bool throwOnFileNotFound, ref StackCrawlMark stackMark)
		{
			AssemblyName an = new AssemblyName ();

			an.SetPublicKey (GetPublicKey ());
			an.Flags = GetFlags () | AssemblyNameFlags.PublicKey;

			if (version == null)
				an.Version = GetVersion ();
			else
				an.Version = version;

			an.CultureInfo = culture;
			an.Name = name;

			Assembly assembly;

			try {
				assembly = AppDomain.CurrentDomain.LoadSatellite (an, false, ref stackMark);
				if (assembly != null)
					return (RuntimeAssembly)assembly;
			} catch (FileNotFoundException) {
				assembly = null;
				// ignore
			}

			if (String.IsNullOrEmpty (Location))
				return null;

			// Try the assembly directory
			string location = Path.GetDirectoryName (Location);
			string fullName = Path.Combine (location, Path.Combine (culture.Name, an.Name + ".dll"));

			try {
				return (RuntimeAssembly)LoadFrom (fullName, false, ref stackMark);
			} catch {
				if (!throwOnFileNotFound && !File.Exists (fullName))
					return null;
				throw;
			}
		}

#if !MOBILE
		Type _Assembly.GetType ()
		{
			// Required or object::GetType becomes virtual final
			return base.GetType ();
		}		
#endif

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		private extern static Assembly LoadFrom (String assemblyFile, bool refOnly, ref StackCrawlMark stackMark);

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		private extern static Assembly LoadFile_internal (String assemblyFile, ref StackCrawlMark stackMark);

		[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
		public static Assembly LoadFrom (String assemblyFile)
		{
			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
			return LoadFrom (assemblyFile, false, ref stackMark);
		}

		[Obsolete]
		[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
		public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence)
		{
			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
			Assembly a = LoadFrom (assemblyFile, false, ref stackMark);
#if !MOBILE
			if ((a != null) && (securityEvidence != null)) {
				// merge evidence (i.e. replace defaults with provided evidences)
				a.Evidence.Merge (securityEvidence);
			}
#endif
			return a;
		}

		[Obsolete]
		[MonoTODO("This overload is not currently implemented")]
		// FIXME: What are we missing?
		public static Assembly LoadFrom (String assemblyFile, Evidence securityEvidence, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
		{
			throw new NotImplementedException ();
		}

		[MonoTODO]
		public static Assembly LoadFrom (String assemblyFile, byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
		{
			throw new NotImplementedException ();
		}

		[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
		public static Assembly UnsafeLoadFrom (String assemblyFile)
		{
			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
			return LoadFrom (assemblyFile, false, ref stackMark);
		}

		[Obsolete]
		[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
		public static Assembly LoadFile (String path, Evidence securityEvidence)
		{
			if (path == null)
				throw new ArgumentNullException ("path");
			if (path == String.Empty)
				throw new ArgumentException ("Path can't be empty", "path");
			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
			Assembly a = LoadFile_internal (path, ref stackMark);
			if (a != null && securityEvidence != null) {
				throw new NotImplementedException ();
			}
			return a;
		}

		public static Assembly LoadFile (String path)
		{
			return LoadFile (path, null);
		}

		public static Assembly Load (String assemblyString)
		{
			return AppDomain.CurrentDomain.Load (assemblyString);
		}

		[Obsolete]
		public static Assembly Load (String assemblyString, Evidence assemblySecurity)
		{
			return AppDomain.CurrentDomain.Load (assemblyString, assemblySecurity);
		}

		public static Assembly Load (AssemblyName assemblyRef)
		{
			return AppDomain.CurrentDomain.Load (assemblyRef);
		}

		[Obsolete]
		public static Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
		{
			return AppDomain.CurrentDomain.Load (assemblyRef, assemblySecurity);
		}

		public static Assembly Load (Byte[] rawAssembly)
		{
			return AppDomain.CurrentDomain.Load (rawAssembly);
		}

		public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore)
		{
			return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
		}

		[Obsolete]
		public static Assembly Load (Byte[] rawAssembly, Byte[] rawSymbolStore,
					     Evidence securityEvidence)
		{
			return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore, securityEvidence);
		}

		[MonoLimitation ("Argument securityContextSource is ignored")]
		public static Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, SecurityContextSource securityContextSource)
		{
			return AppDomain.CurrentDomain.Load (rawAssembly, rawSymbolStore);
		}

		public static Assembly ReflectionOnlyLoad (byte[] rawAssembly)
		{
			return AppDomain.CurrentDomain.Load (rawAssembly, null, null, true);
		}

		[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
		public static Assembly ReflectionOnlyLoad (string assemblyString) 
		{
			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
			return AppDomain.CurrentDomain.Load (assemblyString, null, true, ref stackMark);
		}

		[MethodImplAttribute(MethodImplOptions.NoInlining)] // Methods containing StackCrawlMark local var has to be marked non-inlineable
		public static Assembly ReflectionOnlyLoadFrom (string assemblyFile) 
		{
			if (assemblyFile == null)
				throw new ArgumentNullException ("assemblyFile");

			StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
			return LoadFrom (assemblyFile, true, ref stackMark);
		}

        [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
		public static Assembly LoadWithPartialName (string partialName)
		{
			return LoadWithPartialName (partialName, null);
		}

		[MonoTODO ("Not implemented")]
		public Module LoadModule (string moduleName, byte [] rawModule)
		{
			throw new NotImplementedException ();
		}

		[MonoTODO ("Not implemented")]
		public
		virtual
		Module LoadModule (string moduleName, byte [] rawModule, byte [] rawSymbolStore)
		{
			throw new NotImplementedException ();
		}

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		private static extern Assembly load_with_partial_name (string name, Evidence e);

        [Obsolete("This method has been deprecated. Please use Assembly.Load() instead. http://go.microsoft.com/fwlink/?linkid=14202")]
		public static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence)
		{
			return LoadWithPartialName (partialName, securityEvidence, true);
		}

		/**
		 * LAMESPEC: It is possible for this method to throw exceptions IF the name supplied
		 * is a valid gac name and contains filesystem entry charachters at the end of the name
		 * ie System/// will throw an exception. However ////System will not as that is canocolized
		 * out of the name.
		 */

		// FIXME: LoadWithPartialName must look cache (no CAS) or read from disk (CAS)
		internal static Assembly LoadWithPartialName (string partialName, Evidence securityEvidence, bool oldBehavior)
		{
			if (!oldBehavior)
				throw new NotImplementedException ();

			if (partialName == null)
				throw new NullReferenceException ();

			return load_with_partial_name (partialName, securityEvidence);
		}

		public Object CreateInstance (String typeName) 
		{
			return CreateInstance (typeName, false);
		}

		public Object CreateInstance (String typeName, Boolean ignoreCase)
		{
			Type t = GetType (typeName, false, ignoreCase);
			if (t == null)
				return null;

			try {
				return Activator.CreateInstance (t);
			} catch (InvalidOperationException) {
				throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
			}
		}

		public
		virtual
		Object CreateInstance (String typeName, Boolean ignoreCase,
					      BindingFlags bindingAttr, Binder binder,
					      Object[] args, CultureInfo culture,
					      Object[] activationAttributes)
		{
			Type t = GetType (typeName, false, ignoreCase);
			if (t == null)
				return null;

			try {
				return Activator.CreateInstance (t, bindingAttr, binder, args, culture, activationAttributes);
			} catch (InvalidOperationException) {
				throw new ArgumentException ("It is illegal to invoke a method on a Type loaded via ReflectionOnly methods.");
			}
		}

		public Module[] GetLoadedModules ()
		{
			return GetLoadedModules (false);
		}

		public Module[] GetModules ()
		{
			return GetModules (false);
		}

		internal virtual Module[] GetModulesInternal () {
			throw new NotImplementedException ();
		}
		
		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		public extern static Assembly GetExecutingAssembly ();

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		public extern static Assembly GetCallingAssembly ();

		[MethodImplAttribute (MethodImplOptions.InternalCall)]
		internal static extern IntPtr InternalGetReferencedAssemblies (Assembly module);

		public virtual String[] GetManifestResourceNames ()
		{
			throw new NotImplementedException ();
		}

		internal static AssemblyName[] GetReferencedAssemblies (Assembly module)
		{
			using (var nativeNames = new Mono.SafeGPtrArrayHandle (InternalGetReferencedAssemblies (module))) {
				var numAssemblies = nativeNames.Length;
				try {
					AssemblyName [] result = new AssemblyName[numAssemblies];
					const bool addVersion = true;
					const bool addPublicKey = false;
					const bool defaultToken = true;
					const bool assemblyRef = true;
					for (int i = 0; i < numAssemblies; i++) {
						AssemblyName name = new AssemblyName ();
						unsafe {
							Mono.MonoAssemblyName *nativeName = (Mono.MonoAssemblyName*) nativeNames[i];
							name.FillName (nativeName, null, addVersion, addPublicKey, defaultToken, assemblyRef);
							result[i] = name;
						}
					}
					return result;
				} finally {
					for (int i = 0; i < numAssemblies; i++) {
						unsafe {
							Mono.MonoAssemblyName* nativeName = (Mono.MonoAssemblyName*) nativeNames[i];
							Mono.RuntimeMarshal.FreeAssemblyName (ref *nativeName, true);
						}
					}
				}
			}
		}

		public virtual ManifestResourceInfo GetManifestResourceInfo (String resourceName)
		{
			throw new NotImplementedException ();
		}

		[MonoTODO ("Currently it always returns zero")]
		[ComVisible (false)]
		public
		virtual
		long HostContext {
			get { return 0; }
		}

		internal virtual Module GetManifestModule () {
			throw new NotImplementedException ();
		}

		[ComVisible (false)]
		public virtual bool ReflectionOnly {
			get {
				throw new NotImplementedException ();
			}
		}
		
		public override int GetHashCode ()
		{
			return base.GetHashCode ();
		}

		public override bool Equals (object o)
		{
			return base.Equals (o);
		}

#if !MOBILE
		internal virtual PermissionSet GrantedPermissionSet {
			get {
				throw new NotImplementedException ();
			}
		}

		internal virtual PermissionSet DeniedPermissionSet {
			get {
				throw new NotImplementedException ();
			}
		}
		
		public virtual PermissionSet PermissionSet {
			get {
				throw new NotImplementedException ();
			}
		}
#endif

		public virtual SecurityRuleSet SecurityRuleSet {
			get { throw CreateNIE (); }
		}

		static Exception CreateNIE ()
		{
			return new NotImplementedException ("Derived classes must implement it");
		}
		
		public virtual IList<CustomAttributeData> GetCustomAttributesData ()
		{
			throw new NotImplementedException ();
		}

		[MonoTODO]
		public bool IsFullyTrusted {
			get { return true; }
		}

		public virtual Type GetType (string name, bool throwOnError, bool ignoreCase)
		{
			throw CreateNIE ();
		}

		public virtual Module GetModule (String name)
		{
			throw CreateNIE ();
		}

		public virtual AssemblyName[] GetReferencedAssemblies ()
		{
			throw CreateNIE ();
		}

		public virtual Module[] GetModules (bool getResourceModules)
		{
			throw CreateNIE ();
		}

		[MonoTODO ("Always returns the same as GetModules")]
		public virtual Module[] GetLoadedModules (bool getResourceModules)
		{
			throw CreateNIE ();
		}

		public virtual Assembly GetSatelliteAssembly (CultureInfo culture)
		{
			throw CreateNIE ();
		}

		public virtual Assembly GetSatelliteAssembly (CultureInfo culture, Version version)
		{
			throw CreateNIE ();
		}

		public virtual Module ManifestModule {
			get { throw CreateNIE (); }
		}

		public virtual bool GlobalAssemblyCache {
			get { throw CreateNIE (); }
		}

		public virtual bool IsDynamic {
			get { return false; }
		}

		public static bool operator == (Assembly left, Assembly right)
		{
			if ((object)left == (object)right)
				return true;
			if ((object)left == null ^ (object)right == null)
				return false;
			return left.Equals (right);
		}

		public static bool operator != (Assembly left, Assembly right)
		{
			if ((object)left == (object)right)
				return false;
			if ((object)left == null ^ (object)right == null)
				return true;
			return !left.Equals (right);
		}

		public virtual IEnumerable<TypeInfo> DefinedTypes {
			get {
				foreach (var type in GetTypes ()) {
					yield return type.GetTypeInfo ();
				}
			}
		}

		public virtual IEnumerable<Type> ExportedTypes {
			get { return GetExportedTypes (); }
		}

		public virtual IEnumerable<Module> Modules {
			get { return GetModules (); }
		}

		public virtual IEnumerable<CustomAttributeData> CustomAttributes {
			get { return GetCustomAttributesData (); }
		}

		public virtual Type[] GetForwardedTypes() => throw new PlatformNotSupportedException();
	}
}