5 // Paolo Molaro (lupus@ximian.com)
6 // Dietmar Maurer (dietmar@ximian.com)
7 // Miguel de Icaza (miguel@ximian.com)
8 // Gonzalo Paniagua (gonzalo@ximian.com)
10 // Sebastien Pouliot (sebastien@ximian.com)
12 // (C) 2001, 2002 Ximian, Inc. http://www.ximian.com
13 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
14 // Copyright 2011 Xamarin Inc (http://www.xamarin.com).
16 // Permission is hereby granted, free of charge, to any person obtaining
17 // a copy of this software and associated documentation files (the
18 // "Software"), to deal in the Software without restriction, including
19 // without limitation the rights to use, copy, modify, merge, publish,
20 // distribute, sublicense, and/or sell copies of the Software, and to
21 // permit persons to whom the Software is furnished to do so, subject to
22 // the following conditions:
24 // The above copyright notice and this permission notice shall be
25 // included in all copies or substantial portions of the Software.
27 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
31 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
32 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
33 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 using System.Globalization;
38 using System.Reflection;
40 using System.Reflection.Emit;
42 using System.Threading;
43 using System.Runtime.CompilerServices;
44 using System.Runtime.ExceptionServices;
45 using System.Runtime.InteropServices;
46 using System.Runtime.Remoting;
47 using System.Runtime.Remoting.Contexts;
48 using System.Runtime.Remoting.Channels;
49 using System.Runtime.Remoting.Messaging;
50 using System.Security;
51 using System.Security.Permissions;
52 using System.Security.Policy;
53 using System.Security.Principal;
54 using System.Configuration.Assemblies;
56 using System.Collections.Generic;
57 using System.Runtime.ConstrainedExecution;
64 [ComDefaultInterface (typeof (_AppDomain))]
66 [ClassInterface(ClassInterfaceType.None)]
67 [StructLayout (LayoutKind.Sequential)]
69 public sealed class AppDomain : MarshalByRefObject {
71 public sealed class AppDomain : MarshalByRefObject, _AppDomain, IEvidenceFactory {
73 #pragma warning disable 169
74 #region Sync with object-internals.h
75 IntPtr _mono_app_domain;
77 #pragma warning restore 169
78 static string _process_guid;
81 static Dictionary<string, object> type_resolve_in_progress;
84 static Dictionary<string, object> assembly_resolve_in_progress;
87 static Dictionary<string, object> assembly_resolve_in_progress_refonly;
90 private Evidence _evidence;
91 private PermissionSet _granted;
94 private PrincipalPolicy _principalPolicy;
97 private static IPrincipal _principal;
103 int _principalPolicy;
106 static object _principal;
110 static AppDomain default_domain;
116 [MethodImplAttribute (MethodImplOptions.InternalCall)]
117 private extern AppDomainSetup getSetup ();
122 AppDomainSetup SetupInformationNoCopy {
123 get { return getSetup (); }
126 public AppDomainSetup SetupInformation {
128 AppDomainSetup setup = getSetup ();
129 return new AppDomainSetup (setup);
135 public ApplicationTrust ApplicationTrust {
136 get { throw new NotImplementedException (); }
139 public string BaseDirectory {
141 string path = SetupInformationNoCopy.ApplicationBase;
143 if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
144 // we cannot divulge local file informations
145 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
152 public string RelativeSearchPath {
154 string path = SetupInformationNoCopy.PrivateBinPath;
156 if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
157 // we cannot divulge local file informations
158 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
165 public string DynamicDirectory {
167 AppDomainSetup setup = SetupInformationNoCopy;
168 if (setup.DynamicBase == null)
171 string path = Path.Combine (setup.DynamicBase, setup.ApplicationName);
173 if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
174 // we cannot divulge local file informations
175 new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
182 public bool ShadowCopyFiles {
184 return (SetupInformationNoCopy.ShadowCopyFiles == "true");
188 [MethodImplAttribute (MethodImplOptions.InternalCall)]
189 private extern string getFriendlyName ();
191 public string FriendlyName {
193 return getFriendlyName ();
197 public Evidence Evidence {
202 // if the host (runtime) hasn't provided it's own evidence...
203 if (_evidence == null) {
204 // ... we will provide our own
206 // the executed assembly from the "default" appdomain
207 // or null if we're not in the default appdomain or
208 // if there is no entry assembly (embedded mono)
209 Assembly a = Assembly.GetEntryAssembly ();
211 if (this == DefaultDomain)
213 return new Evidence ();
215 _evidence = AppDomain.DefaultDomain.Evidence;
217 _evidence = Evidence.GetDefaultHostEvidence (a);
221 return new Evidence ((Evidence)_evidence); // return a copy
226 internal IPrincipal DefaultPrincipal {
228 if (_principal == null) {
229 switch ((PrincipalPolicy)_principalPolicy) {
230 case PrincipalPolicy.UnauthenticatedPrincipal:
231 _principal = new GenericPrincipal (
232 new GenericIdentity (String.Empty, String.Empty), null);
234 case PrincipalPolicy.WindowsPrincipal:
235 _principal = new WindowsPrincipal (WindowsIdentity.GetCurrent ());
239 return (IPrincipal)_principal;
243 // for AppDomain there is only an allowed (i.e. granted) set
244 // http://msdn.microsoft.com/library/en-us/cpguide/html/cpcondetermininggrantedpermissions.asp
245 internal PermissionSet GrantedPermissionSet {
246 get { return (PermissionSet)_granted; }
250 public PermissionSet PermissionSet {
251 get { return (PermissionSet)_granted ?? (PermissionSet)(_granted = new PermissionSet (PermissionState.Unrestricted)); }
255 [MethodImplAttribute (MethodImplOptions.InternalCall)]
256 private static extern AppDomain getCurDomain ();
258 public static AppDomain CurrentDomain {
260 return getCurDomain ();
264 [MethodImplAttribute (MethodImplOptions.InternalCall)]
265 private static extern AppDomain getRootDomain ();
267 internal static AppDomain DefaultDomain {
269 if (default_domain == null) {
270 AppDomain rd = getRootDomain ();
271 if (rd == CurrentDomain)
274 default_domain = (AppDomain) RemotingServices.GetDomainProxy (rd);
276 return default_domain;
280 [Obsolete ("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead.")]
281 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
282 public void AppendPrivatePath (string path)
284 if (path == null || path.Length == 0)
287 AppDomainSetup setup = SetupInformationNoCopy;
289 string pp = setup.PrivateBinPath;
290 if (pp == null || pp.Length == 0) {
291 setup.PrivateBinPath = path;
296 if (pp [pp.Length - 1] != Path.PathSeparator)
297 pp += Path.PathSeparator;
299 setup.PrivateBinPath = pp + path;
302 [Obsolete ("AppDomain.ClearPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead.")]
303 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
304 public void ClearPrivatePath ()
306 SetupInformationNoCopy.PrivateBinPath = String.Empty;
309 [Obsolete ("Use AppDomainSetup.ShadowCopyDirectories")]
310 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
311 public void ClearShadowCopyPath ()
313 SetupInformationNoCopy.ShadowCopyDirectories = String.Empty;
317 public ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName)
319 return Activator.CreateComInstanceFrom (assemblyName, typeName);
322 public ObjectHandle CreateComInstanceFrom (string assemblyFile, string typeName,
323 byte [] hashValue, AssemblyHashAlgorithm hashAlgorithm)
325 return Activator.CreateComInstanceFrom (assemblyFile, typeName, hashValue ,hashAlgorithm);
329 public ObjectHandle CreateInstance (string assemblyName, string typeName)
331 if (assemblyName == null)
332 throw new ArgumentNullException ("assemblyName");
334 return Activator.CreateInstance (assemblyName, typeName);
337 public ObjectHandle CreateInstance (string assemblyName, string typeName, object[] activationAttributes)
339 if (assemblyName == null)
340 throw new ArgumentNullException ("assemblyName");
342 return Activator.CreateInstance (assemblyName, typeName, activationAttributes);
346 [Obsolete ("Use an overload that does not take an Evidence parameter")]
348 public ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr,
349 Binder binder, object[] args, CultureInfo culture, object[] activationAttributes,
350 Evidence securityAttributes)
352 if (assemblyName == null)
353 throw new ArgumentNullException ("assemblyName");
355 return Activator.CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args,
356 culture, activationAttributes, securityAttributes);
359 public object CreateInstanceAndUnwrap (string assemblyName, string typeName)
361 ObjectHandle oh = CreateInstance (assemblyName, typeName);
362 return (oh != null) ? oh.Unwrap () : null;
365 public object CreateInstanceAndUnwrap (string assemblyName, string typeName, object [] activationAttributes)
367 ObjectHandle oh = CreateInstance (assemblyName, typeName, activationAttributes);
368 return (oh != null) ? oh.Unwrap () : null;
372 [Obsolete ("Use an overload that does not take an Evidence parameter")]
374 public object CreateInstanceAndUnwrap (string assemblyName, string typeName, bool ignoreCase,
375 BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
376 object[] activationAttributes, Evidence securityAttributes)
378 ObjectHandle oh = CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args,
379 culture, activationAttributes, securityAttributes);
380 return (oh != null) ? oh.Unwrap () : null;
384 public ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase, BindingFlags bindingAttr,
385 Binder binder, object[] args, CultureInfo culture, object[] activationAttributes)
387 if (assemblyName == null)
388 throw new ArgumentNullException ("assemblyName");
390 return Activator.CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args,
391 culture, activationAttributes, null);
393 public object CreateInstanceAndUnwrap (string assemblyName, string typeName, bool ignoreCase,
394 BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
395 object[] activationAttributes)
397 ObjectHandle oh = CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args,
398 culture, activationAttributes);
399 return (oh != null) ? oh.Unwrap () : null;
402 public ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase,
403 BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
404 object[] activationAttributes)
406 if (assemblyFile == null)
407 throw new ArgumentNullException ("assemblyFile");
409 return Activator.CreateInstanceFrom (assemblyFile, typeName, ignoreCase, bindingAttr, binder, args,
410 culture, activationAttributes, null);
413 public object CreateInstanceFromAndUnwrap (string assemblyFile, string typeName, bool ignoreCase,
414 BindingFlags bindingAttr, Binder binder, object[] args,
415 CultureInfo culture, object[] activationAttributes)
417 ObjectHandle oh = CreateInstanceFrom (assemblyFile, typeName, ignoreCase, bindingAttr, binder, args,
418 culture, activationAttributes);
420 return (oh != null) ? oh.Unwrap () : null;
424 public ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName)
426 if (assemblyFile == null)
427 throw new ArgumentNullException ("assemblyFile");
429 return Activator.CreateInstanceFrom (assemblyFile, typeName);
432 public ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, object[] activationAttributes)
434 if (assemblyFile == null)
435 throw new ArgumentNullException ("assemblyFile");
437 return Activator.CreateInstanceFrom (assemblyFile, typeName, activationAttributes);
441 [Obsolete ("Use an overload that does not take an Evidence parameter")]
443 public ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase,
444 BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
445 object[] activationAttributes, Evidence securityAttributes)
447 if (assemblyFile == null)
448 throw new ArgumentNullException ("assemblyFile");
450 return Activator.CreateInstanceFrom (assemblyFile, typeName, ignoreCase, bindingAttr, binder, args,
451 culture, activationAttributes, securityAttributes);
454 public object CreateInstanceFromAndUnwrap (string assemblyName, string typeName)
456 ObjectHandle oh = CreateInstanceFrom (assemblyName, typeName);
457 return (oh != null) ? oh.Unwrap () : null;
460 public object CreateInstanceFromAndUnwrap (string assemblyName, string typeName, object [] activationAttributes)
462 ObjectHandle oh = CreateInstanceFrom (assemblyName, typeName, activationAttributes);
463 return (oh != null) ? oh.Unwrap () : null;
467 [Obsolete ("Use an overload that does not take an Evidence parameter")]
469 public object CreateInstanceFromAndUnwrap (string assemblyName, string typeName, bool ignoreCase,
470 BindingFlags bindingAttr, Binder binder, object[] args,
471 CultureInfo culture, object[] activationAttributes,
472 Evidence securityAttributes)
474 ObjectHandle oh = CreateInstanceFrom (assemblyName, typeName, ignoreCase, bindingAttr, binder, args,
475 culture, activationAttributes, securityAttributes);
477 return (oh != null) ? oh.Unwrap () : null;
480 #if !FULL_AOT_RUNTIME
481 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
483 return DefineDynamicAssembly (name, access, null, null, null, null, null, false);
487 [Obsolete ("Declarative security for assembly level is no longer enforced")]
489 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence)
491 return DefineDynamicAssembly (name, access, null, evidence, null, null, null, false);
494 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir)
496 return DefineDynamicAssembly (name, access, dir, null, null, null, null, false);
500 [Obsolete ("Declarative security for assembly level is no longer enforced")]
502 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
505 return DefineDynamicAssembly (name, access, dir, evidence, null, null, null, false);
509 [Obsolete ("Declarative security for assembly level is no longer enforced")]
511 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
512 PermissionSet requiredPermissions,
513 PermissionSet optionalPermissions,
514 PermissionSet refusedPermissions)
516 return DefineDynamicAssembly (name, access, null, null, requiredPermissions, optionalPermissions,
517 refusedPermissions, false);
521 [Obsolete ("Declarative security for assembly level is no longer enforced")]
523 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence,
524 PermissionSet requiredPermissions,
525 PermissionSet optionalPermissions,
526 PermissionSet refusedPermissions)
528 return DefineDynamicAssembly (name, access, null, evidence, requiredPermissions, optionalPermissions,
529 refusedPermissions, false);
533 [Obsolete ("Declarative security for assembly level is no longer enforced")]
535 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
536 PermissionSet requiredPermissions,
537 PermissionSet optionalPermissions,
538 PermissionSet refusedPermissions)
540 return DefineDynamicAssembly (name, access, dir, null, requiredPermissions, optionalPermissions,
541 refusedPermissions, false);
545 [Obsolete ("Declarative security for assembly level is no longer enforced")]
547 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
549 PermissionSet requiredPermissions,
550 PermissionSet optionalPermissions,
551 PermissionSet refusedPermissions)
553 return DefineDynamicAssembly (name, access, dir, evidence, requiredPermissions, optionalPermissions,
554 refusedPermissions, false);
558 [Obsolete ("Declarative security for assembly level is no longer enforced")]
560 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
562 PermissionSet requiredPermissions,
563 PermissionSet optionalPermissions,
564 PermissionSet refusedPermissions, bool isSynchronized)
567 throw new ArgumentNullException ("name");
568 ValidateAssemblyName (name.Name);
570 // FIXME: examine all other parameters
572 AssemblyBuilder ab = new AssemblyBuilder (name, dir, access, false);
573 ab.AddPermissionRequests (requiredPermissions, optionalPermissions, refusedPermissions);
579 [Obsolete ("Declarative security for assembly level is no longer enforced")]
581 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
583 PermissionSet requiredPermissions,
584 PermissionSet optionalPermissions,
585 PermissionSet refusedPermissions, bool isSynchronized, IEnumerable<CustomAttributeBuilder> assemblyAttributes)
587 AssemblyBuilder ab = DefineDynamicAssembly (name, access, dir, evidence, requiredPermissions, optionalPermissions, refusedPermissions, isSynchronized);
588 if (assemblyAttributes != null)
589 foreach (CustomAttributeBuilder cb in assemblyAttributes) {
590 ab.SetCustomAttribute (cb);
596 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> assemblyAttributes)
598 return DefineDynamicAssembly (name, access, null, null, null, null, null, false, assemblyAttributes);
602 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir, bool isSynchronized, IEnumerable<CustomAttributeBuilder> assemblyAttributes)
604 return DefineDynamicAssembly (name, access, dir, null, null, null, null, isSynchronized, assemblyAttributes);
607 [MonoLimitation ("The argument securityContextSource is ignored")]
608 public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, IEnumerable<CustomAttributeBuilder> assemblyAttributes, SecurityContextSource securityContextSource)
610 return DefineDynamicAssembly (name, access, assemblyAttributes);
614 internal AssemblyBuilder DefineInternalDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
616 return new AssemblyBuilder (name, null, access, true);
621 // AppDomain.DoCallBack works because AppDomain is a MarshalByRefObject
622 // so, when you call AppDomain.DoCallBack, that's a remote call
624 public void DoCallBack (CrossAppDomainDelegate callBackDelegate)
626 if (callBackDelegate != null)
630 public int ExecuteAssembly (string assemblyFile)
632 return ExecuteAssembly (assemblyFile, (Evidence)null, null);
636 [Obsolete ("Use an overload that does not take an Evidence parameter")]
638 public int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity)
640 return ExecuteAssembly (assemblyFile, assemblySecurity, null);
644 [Obsolete ("Use an overload that does not take an Evidence parameter")]
646 public int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args)
648 Assembly a = Assembly.LoadFrom (assemblyFile, assemblySecurity);
649 return ExecuteAssemblyInternal (a, args);
653 [Obsolete ("Use an overload that does not take an Evidence parameter")]
655 public int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
657 Assembly a = Assembly.LoadFrom (assemblyFile, assemblySecurity, hashValue, hashAlgorithm);
658 return ExecuteAssemblyInternal (a, args);
663 public int ExecuteAssembly (string assemblyFile, string[] args)
665 Assembly a = Assembly.LoadFrom (assemblyFile, null);
666 return ExecuteAssemblyInternal (a, args);
669 public int ExecuteAssembly (string assemblyFile, string[] args, byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)
671 Assembly a = Assembly.LoadFrom (assemblyFile, null, hashValue, hashAlgorithm);
672 return ExecuteAssemblyInternal (a, args);
676 int ExecuteAssemblyInternal (Assembly a, string[] args)
678 if (a.EntryPoint == null)
679 throw new MissingMethodException ("Entry point not found in assembly '" + a.FullName + "'.");
680 return ExecuteAssembly (a, args);
683 [MethodImplAttribute (MethodImplOptions.InternalCall)]
684 private extern int ExecuteAssembly (Assembly a, string[] args);
686 [MethodImplAttribute (MethodImplOptions.InternalCall)]
687 private extern Assembly [] GetAssemblies (bool refOnly);
689 public Assembly [] GetAssemblies ()
691 return GetAssemblies (false);
694 [MethodImplAttribute (MethodImplOptions.InternalCall)]
695 public extern object GetData (string name);
697 public new Type GetType()
699 return base.GetType ();
702 public override object InitializeLifetimeService ()
707 [MethodImplAttribute (MethodImplOptions.InternalCall)]
708 internal extern Assembly LoadAssembly (string assemblyRef, Evidence securityEvidence, bool refOnly);
710 public Assembly Load (AssemblyName assemblyRef)
712 return Load (assemblyRef, null);
715 internal Assembly LoadSatellite (AssemblyName assemblyRef, bool throwOnError)
717 if (assemblyRef == null)
718 throw new ArgumentNullException ("assemblyRef");
720 Assembly result = LoadAssembly (assemblyRef.FullName, null, false);
721 if (result == null && throwOnError)
722 throw new FileNotFoundException (null, assemblyRef.Name);
727 [Obsolete ("Use an overload that does not take an Evidence parameter")]
729 public Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity)
731 if (assemblyRef == null)
732 throw new ArgumentNullException ("assemblyRef");
734 if (assemblyRef.Name == null || assemblyRef.Name.Length == 0) {
735 if (assemblyRef.CodeBase != null)
736 return Assembly.LoadFrom (assemblyRef.CodeBase, assemblySecurity);
738 throw new ArgumentException (Locale.GetText ("assemblyRef.Name cannot be empty."), "assemblyRef");
741 Assembly assembly = LoadAssembly (assemblyRef.FullName, assemblySecurity, false);
742 if (assembly != null)
745 if (assemblyRef.CodeBase == null)
746 throw new FileNotFoundException (null, assemblyRef.Name);
748 string cb = assemblyRef.CodeBase;
749 if (cb.ToLower (CultureInfo.InvariantCulture).StartsWith ("file://"))
750 cb = new Mono.Security.Uri (cb).LocalPath;
753 assembly = Assembly.LoadFrom (cb, assemblySecurity);
755 throw new FileNotFoundException (null, assemblyRef.Name);
757 AssemblyName aname = assembly.GetName ();
758 // Name, version, culture, publickeytoken. Anything else?
759 if (assemblyRef.Name != aname.Name)
760 throw new FileNotFoundException (null, assemblyRef.Name);
762 if (assemblyRef.Version != null && assemblyRef.Version != new Version (0, 0, 0, 0) && assemblyRef.Version != aname.Version)
763 throw new FileNotFoundException (null, assemblyRef.Name);
765 if (assemblyRef.CultureInfo != null && assemblyRef.CultureInfo.Equals (aname))
766 throw new FileNotFoundException (null, assemblyRef.Name);
768 byte [] pt = assemblyRef.GetPublicKeyToken ();
769 if (pt != null && pt.Length != 0) {
770 byte [] loaded_pt = aname.GetPublicKeyToken ();
771 if (loaded_pt == null || (pt.Length != loaded_pt.Length))
772 throw new FileNotFoundException (null, assemblyRef.Name);
773 for (int i = pt.Length - 1; i >= 0; i--)
774 if (loaded_pt [i] != pt [i])
775 throw new FileNotFoundException (null, assemblyRef.Name);
780 public Assembly Load (string assemblyString)
782 return Load (assemblyString, null, false);
786 [Obsolete ("Use an overload that does not take an Evidence parameter")]
788 public Assembly Load (string assemblyString, Evidence assemblySecurity)
790 return Load (assemblyString, assemblySecurity, false);
793 internal Assembly Load (string assemblyString, Evidence assemblySecurity, bool refonly)
795 if (assemblyString == null)
796 throw new ArgumentNullException ("assemblyString");
798 if (assemblyString.Length == 0)
799 throw new ArgumentException ("assemblyString cannot have zero length");
801 Assembly assembly = LoadAssembly (assemblyString, assemblySecurity, refonly);
802 if (assembly == null)
803 throw new FileNotFoundException (null, assemblyString);
807 public Assembly Load (byte[] rawAssembly)
809 return Load (rawAssembly, null, null);
812 public Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore)
814 return Load (rawAssembly, rawSymbolStore, null);
817 [MethodImplAttribute (MethodImplOptions.InternalCall)]
818 internal extern Assembly LoadAssemblyRaw (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence, bool refonly);
821 [Obsolete ("Use an overload that does not take an Evidence parameter")]
823 public Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence)
825 return Load (rawAssembly, rawSymbolStore, securityEvidence, false);
828 internal Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, Evidence securityEvidence, bool refonly)
830 if (rawAssembly == null)
831 throw new ArgumentNullException ("rawAssembly");
833 Assembly assembly = LoadAssemblyRaw (rawAssembly, rawSymbolStore, securityEvidence, refonly);
834 assembly.FromByteArray = true;
838 [Obsolete ("AppDomain policy levels are obsolete")]
840 [SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
841 public void SetAppDomainPolicy (PolicyLevel domainPolicy)
843 if (domainPolicy == null)
844 throw new ArgumentNullException ("domainPolicy");
845 if (_granted != null) {
846 throw new PolicyException (Locale.GetText (
847 "An AppDomain policy is already specified."));
849 if (IsFinalizingForUnload ())
850 throw new AppDomainUnloadedException ();
852 PolicyStatement ps = domainPolicy.Resolve ((Evidence)_evidence);
853 _granted = ps.PermissionSet;
856 [Obsolete ("Use AppDomainSetup.SetCachePath")]
857 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
858 public void SetCachePath (string path)
860 SetupInformationNoCopy.CachePath = path;
863 [SecurityPermission (SecurityAction.Demand, ControlPrincipal = true)]
864 public void SetPrincipalPolicy (PrincipalPolicy policy)
866 if (IsFinalizingForUnload ())
867 throw new AppDomainUnloadedException ();
870 _principalPolicy = (int)policy;
872 _principalPolicy = policy;
877 [Obsolete ("Use AppDomainSetup.ShadowCopyFiles")]
878 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
879 public void SetShadowCopyFiles()
881 SetupInformationNoCopy.ShadowCopyFiles = "true";
884 [Obsolete ("Use AppDomainSetup.ShadowCopyDirectories")]
885 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
886 public void SetShadowCopyPath (string path)
888 SetupInformationNoCopy.ShadowCopyDirectories = path;
891 [SecurityPermission (SecurityAction.Demand, ControlPrincipal = true)]
892 public void SetThreadPrincipal (IPrincipal principal)
894 if (principal == null)
895 throw new ArgumentNullException ("principal");
896 if (_principal != null)
897 throw new PolicyException (Locale.GetText ("principal already present."));
898 if (IsFinalizingForUnload ())
899 throw new AppDomainUnloadedException ();
901 _principal = principal;
904 [MethodImplAttribute (MethodImplOptions.InternalCall)]
905 private static extern AppDomain InternalSetDomainByID (int domain_id);
907 // Changes the active domain and returns the old domain
908 [MethodImplAttribute (MethodImplOptions.InternalCall)]
909 private static extern AppDomain InternalSetDomain (AppDomain context);
911 // Notifies the runtime that this thread references 'domain'.
912 [MethodImplAttribute (MethodImplOptions.InternalCall)]
913 internal static extern void InternalPushDomainRef (AppDomain domain);
915 [MethodImplAttribute (MethodImplOptions.InternalCall)]
916 internal static extern void InternalPushDomainRefByID (int domain_id);
918 // Undoes the effect of the last PushDomainRef call
919 [MethodImplAttribute (MethodImplOptions.InternalCall)]
920 internal static extern void InternalPopDomainRef ();
922 // Changes the active context and returns the old context
923 [MethodImplAttribute (MethodImplOptions.InternalCall)]
924 internal static extern Context InternalSetContext (Context context);
926 // Returns the current context
927 [MethodImplAttribute (MethodImplOptions.InternalCall)]
928 internal static extern Context InternalGetContext ();
930 // Returns the current context
931 [MethodImplAttribute (MethodImplOptions.InternalCall)]
932 internal static extern Context InternalGetDefaultContext ();
934 [MethodImplAttribute (MethodImplOptions.InternalCall)]
935 internal static extern string InternalGetProcessGuid (string newguid);
937 // This method is handled specially by the runtime
938 // It is the only managed method which is allowed to set the current
940 internal static object InvokeInDomain (AppDomain domain, MethodInfo method, object obj, object [] args)
942 AppDomain current = CurrentDomain;
947 InternalPushDomainRef (domain);
949 InternalSetDomain (domain);
950 object o = ((MonoMethod) method).InternalInvoke (obj, args, out exc);
956 InternalSetDomain (current);
958 InternalPopDomainRef ();
962 internal static object InvokeInDomainByID (int domain_id, MethodInfo method, object obj, object [] args)
964 AppDomain current = CurrentDomain;
969 InternalPushDomainRefByID (domain_id);
971 InternalSetDomainByID (domain_id);
972 object o = ((MonoMethod) method).InternalInvoke (obj, args, out exc);
978 InternalSetDomain (current);
980 InternalPopDomainRef ();
984 internal static String GetProcessGuid ()
986 if (_process_guid == null) {
987 _process_guid = InternalGetProcessGuid (Guid.NewGuid().ToString ());
989 return _process_guid;
992 public static AppDomain CreateDomain (string friendlyName)
994 return CreateDomain (friendlyName, null, null);
997 public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo)
999 return CreateDomain (friendlyName, securityInfo, null);
1002 [MethodImplAttribute (MethodImplOptions.InternalCall)]
1003 private static extern AppDomain createDomain (string friendlyName, AppDomainSetup info);
1005 [MonoLimitationAttribute ("Currently it does not allow the setup in the other domain")]
1006 [SecurityPermission (SecurityAction.Demand, ControlAppDomain = true)]
1007 public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info)
1009 if (friendlyName == null)
1010 throw new System.ArgumentNullException ("friendlyName");
1012 AppDomain def = AppDomain.DefaultDomain;
1014 // if null, get default domain's SetupInformation
1016 info = new AppDomainSetup (); // we're default!
1018 info = def.SetupInformation;
1021 info = new AppDomainSetup (info); // copy
1023 // todo: allow setup in the other domain
1025 if (!info.Equals (def.SetupInformation)) {
1026 // If not specified use default domain's app base.
1027 if (info.ApplicationBase == null)
1028 info.ApplicationBase = def.SetupInformation.ApplicationBase;
1029 if (info.ConfigurationFile == null)
1030 info.ConfigurationFile = Path.GetFileName (def.SetupInformation.ConfigurationFile);
1032 } else if (info.ConfigurationFile == null)
1033 info.ConfigurationFile = "[I don't have a config file]";
1036 if (info.AppDomainInitializer != null) {
1037 if (!info.AppDomainInitializer.Method.IsStatic)
1038 throw new ArgumentException ("Non-static methods cannot be invoked as an appdomain initializer");
1042 info.SerializeNonPrimitives ();
1044 AppDomain ad = (AppDomain) RemotingServices.GetDomainProxy (createDomain (friendlyName, info));
1045 if (securityInfo == null) {
1046 // get default domain's Evidence (unless we're are the default!)
1048 ad._evidence = null; // we'll get them later (GetEntryAssembly)
1050 ad._evidence = def.Evidence; // new (shallow) copy
1053 ad._evidence = new Evidence (securityInfo); // copy
1056 if (info.AppDomainInitializer != null) {
1057 Loader loader = new Loader (
1058 info.AppDomainInitializer.Method.DeclaringType.Assembly.Location);
1059 ad.DoCallBack (loader.Load);
1061 Initializer initializer = new Initializer (
1062 info.AppDomainInitializer,
1063 info.AppDomainInitializerArguments);
1064 ad.DoCallBack (initializer.Initialize);
1077 public Loader (string assembly)
1079 this.assembly = assembly;
1084 Assembly.LoadFrom (assembly);
1091 AppDomainInitializer initializer;
1092 string [] arguments;
1094 public Initializer (AppDomainInitializer initializer, string [] arguments)
1096 this.initializer = initializer;
1097 this.arguments = arguments;
1100 public void Initialize ()
1102 initializer (arguments);
1107 public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo,string appBasePath,
1108 string appRelativeSearchPath, bool shadowCopyFiles)
1110 return CreateDomain (friendlyName, securityInfo, CreateDomainSetup (appBasePath, appRelativeSearchPath, shadowCopyFiles));
1114 public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info,
1115 PermissionSet grantSet, params StrongName [] fullTrustAssemblies)
1118 throw new ArgumentNullException ("info");
1120 info.ApplicationTrust = new ApplicationTrust (grantSet, fullTrustAssemblies ?? EmptyArray<StrongName>.Value);
1121 return CreateDomain (friendlyName, securityInfo, info);
1125 static AppDomainSetup CreateDomainSetup (string appBasePath, string appRelativeSearchPath, bool shadowCopyFiles)
1127 AppDomainSetup info = new AppDomainSetup ();
1129 info.ApplicationBase = appBasePath;
1130 info.PrivateBinPath = appRelativeSearchPath;
1132 if (shadowCopyFiles)
1133 info.ShadowCopyFiles = "true";
1135 info.ShadowCopyFiles = "false";
1140 [MethodImplAttribute (MethodImplOptions.InternalCall)]
1141 private static extern bool InternalIsFinalizingForUnload (int domain_id);
1143 public bool IsFinalizingForUnload()
1145 return InternalIsFinalizingForUnload (getDomainID ());
1148 [MethodImplAttribute (MethodImplOptions.InternalCall)]
1149 static extern void InternalUnload (int domain_id);
1151 // We do this because if the domain is a transparant proxy this
1152 // will still return the correct domain id.
1153 private int getDomainID ()
1155 return Thread.GetDomainID ();
1158 [SecurityPermission (SecurityAction.Demand, ControlAppDomain = true)]
1159 [ReliabilityContractAttribute (Consistency.MayCorruptAppDomain, Cer.MayFail)]
1160 public static void Unload (AppDomain domain)
1163 throw new ArgumentNullException ("domain");
1165 InternalUnload (domain.getDomainID());
1168 [MethodImplAttribute (MethodImplOptions.InternalCall)]
1169 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1170 public extern void SetData (string name, object data);
1172 [MonoLimitation ("The permission field is ignored")]
1173 public void SetData (string name, object data, IPermission permission)
1175 SetData (name, data);
1179 [Obsolete ("Use AppDomainSetup.DynamicBase")]
1180 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1181 public void SetDynamicBase (string path)
1183 SetupInformationNoCopy.DynamicBase = path;
1187 [Obsolete ("AppDomain.GetCurrentThreadId has been deprecated"
1188 + " because it does not provide a stable Id when managed"
1189 + " threads are running on fibers (aka lightweight"
1190 + " threads). To get a stable identifier for a managed"
1191 + " thread, use the ManagedThreadId property on Thread.'")]
1192 public static int GetCurrentThreadId ()
1194 return Thread.CurrentThreadId;
1197 public override string ToString ()
1199 return getFriendlyName ();
1202 private static void ValidateAssemblyName (string name)
1204 if (name == null || name.Length == 0)
1205 throw new ArgumentException ("The Name of " +
1206 "AssemblyName cannot be null or a " +
1207 "zero-length string.");
1209 bool isValid = true;
1211 for (int i = 0; i < name.Length; i++) {
1214 // do not allow leading whitespace
1215 if (i == 0 && char.IsWhiteSpace (c)) {
1220 // do not allow /,\ or : in name
1221 if (c == '/' || c == '\\' || c == ':') {
1228 throw new ArgumentException ("The Name of " +
1229 "AssemblyName cannot start with " +
1230 "whitespace, or contain '/', '\\' " +
1234 // The following methods are called from the runtime. Don't change signatures.
1235 #pragma warning disable 169
1236 private void DoAssemblyLoad (Assembly assembly)
1238 if (AssemblyLoad == null)
1241 AssemblyLoad (this, new AssemblyLoadEventArgs (assembly));
1244 private Assembly DoAssemblyResolve (string name, bool refonly)
1246 ResolveEventHandler del;
1249 del = ReflectionOnlyAssemblyResolve;
1251 del = AssemblyResolve;
1253 del = AssemblyResolve;
1258 /* Prevent infinite recursion */
1259 Dictionary<string, object> ht;
1261 ht = assembly_resolve_in_progress_refonly;
1263 ht = new Dictionary<string, object> ();
1264 assembly_resolve_in_progress_refonly = ht;
1267 ht = assembly_resolve_in_progress;
1269 ht = new Dictionary<string, object> ();
1270 assembly_resolve_in_progress = ht;
1274 if (ht.ContainsKey (name))
1279 Delegate[] invocation_list = del.GetInvocationList ();
1281 foreach (Delegate eh in invocation_list) {
1282 ResolveEventHandler handler = (ResolveEventHandler) eh;
1283 Assembly assembly = handler (this, new ResolveEventArgs (name));
1284 if (assembly != null)
1294 internal Assembly DoTypeResolve (Object name_or_tb)
1296 if (TypeResolve == null)
1301 #if !FULL_AOT_RUNTIME
1302 if (name_or_tb is TypeBuilder)
1303 name = ((TypeBuilder) name_or_tb).FullName;
1306 name = (string) name_or_tb;
1308 /* Prevent infinite recursion */
1309 var ht = type_resolve_in_progress;
1311 type_resolve_in_progress = ht = new Dictionary<string, object> ();
1314 if (ht.ContainsKey (name))
1320 foreach (Delegate d in TypeResolve.GetInvocationList ()) {
1321 ResolveEventHandler eh = (ResolveEventHandler) d;
1322 Assembly assembly = eh (this, new ResolveEventArgs (name));
1323 if (assembly != null)
1333 internal Assembly DoResourceResolve (string name, Assembly requesting) {
1334 if (ResourceResolve == null)
1337 Delegate[] invocation_list = ResourceResolve.GetInvocationList ();
1339 foreach (Delegate eh in invocation_list) {
1340 ResolveEventHandler handler = (ResolveEventHandler) eh;
1342 Assembly assembly = handler (this, new ResolveEventArgs (name, requesting));
1344 Assembly assembly = handler (this, new ResolveEventArgs (name));
1346 if (assembly != null)
1352 private void DoDomainUnload ()
1354 if (DomainUnload != null)
1355 DomainUnload(this, null);
1358 internal void DoUnhandledException (UnhandledExceptionEventArgs args) {
1359 if (UnhandledException != null)
1360 UnhandledException (this, args);
1363 internal byte[] GetMarshalledDomainObjRef ()
1365 ObjRef oref = RemotingServices.Marshal (AppDomain.CurrentDomain, null, typeof (AppDomain));
1366 return CADSerializer.SerializeObject (oref).GetBuffer();
1369 internal void ProcessMessageInDomain (byte[] arrRequest, CADMethodCallMessage cadMsg,
1370 out byte[] arrResponse, out CADMethodReturnMessage cadMrm)
1374 if (null != arrRequest)
1375 reqDomMsg = CADSerializer.DeserializeMessage (new MemoryStream(arrRequest), null);
1377 reqDomMsg = new MethodCall (cadMsg);
1379 IMessage retDomMsg = ChannelServices.SyncDispatchMessage (reqDomMsg);
1381 cadMrm = CADMethodReturnMessage.Create (retDomMsg);
1382 if (null == cadMrm) {
1383 arrResponse = CADSerializer.SerializeMessage (retDomMsg).GetBuffer();
1389 #pragma warning restore 169
1391 // End of methods called from the runtime
1393 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1394 public event AssemblyLoadEventHandler AssemblyLoad;
1396 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1397 public event ResolveEventHandler AssemblyResolve;
1399 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1400 public event EventHandler DomainUnload;
1402 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1403 public event EventHandler ProcessExit;
1405 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1406 public event ResolveEventHandler ResourceResolve;
1408 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1409 public event ResolveEventHandler TypeResolve;
1411 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
1412 public event UnhandledExceptionEventHandler UnhandledException;
1415 public event EventHandler<FirstChanceExceptionEventArgs> FirstChanceException;
1420 public bool IsHomogenous {
1421 get { return true; }
1425 public bool IsFullyTrusted {
1426 get { return true; }
1430 #pragma warning disable 649
1432 private AppDomainManager _domain_manager;
1434 object _domain_manager;
1436 #pragma warning restore 649
1439 public AppDomainManager DomainManager {
1440 get { return (AppDomainManager)_domain_manager; }
1444 public event ResolveEventHandler ReflectionOnlyAssemblyResolve;
1447 #pragma warning disable 649
1449 private object _activation;
1450 private object _applicationIdentity;
1452 private ActivationContext _activation;
1453 private ApplicationIdentity _applicationIdentity;
1455 #pragma warning restore 649
1459 public ActivationContext ActivationContext {
1460 get { return (ActivationContext)_activation; }
1463 public ApplicationIdentity ApplicationIdentity {
1464 get { return (ApplicationIdentity)_applicationIdentity; }
1468 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
1469 get { return getDomainID (); }
1474 [MonoTODO ("This routine only returns the parameter currently")]
1475 [ComVisible (false)]
1476 public string ApplyPolicy (string assemblyName)
1478 if (assemblyName == null)
1479 throw new ArgumentNullException ("assemblyName");
1480 if (assemblyName.Length == 0) // String.Empty
1481 throw new ArgumentException ("assemblyName");
1482 return assemblyName;
1487 public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, string appBasePath,
1488 string appRelativeSearchPath, bool shadowCopyFiles, AppDomainInitializer adInit, string[] adInitArgs)
1490 AppDomainSetup info = CreateDomainSetup (appBasePath, appRelativeSearchPath, shadowCopyFiles);
1492 info.AppDomainInitializerArguments = adInitArgs;
1493 info.AppDomainInitializer = adInit;
1495 return CreateDomain (friendlyName, securityInfo, info);
1498 public int ExecuteAssemblyByName (string assemblyName)
1500 return ExecuteAssemblyByName (assemblyName, (Evidence)null, null);
1504 [Obsolete ("Use an overload that does not take an Evidence parameter")]
1506 public int ExecuteAssemblyByName (string assemblyName, Evidence assemblySecurity)
1508 return ExecuteAssemblyByName (assemblyName, assemblySecurity, null);
1512 [Obsolete ("Use an overload that does not take an Evidence parameter")]
1514 public int ExecuteAssemblyByName (string assemblyName, Evidence assemblySecurity, params string[] args)
1516 Assembly a = Assembly.Load (assemblyName, assemblySecurity);
1518 return ExecuteAssemblyInternal (a, args);
1522 [Obsolete ("Use an overload that does not take an Evidence parameter")]
1524 public int ExecuteAssemblyByName (AssemblyName assemblyName, Evidence assemblySecurity, params string[] args)
1526 Assembly a = Assembly.Load (assemblyName, assemblySecurity);
1528 return ExecuteAssemblyInternal (a, args);
1532 public int ExecuteAssemblyByName (string assemblyName, params string[] args)
1534 Assembly a = Assembly.Load (assemblyName, null);
1536 return ExecuteAssemblyInternal (a, args);
1539 public int ExecuteAssemblyByName (AssemblyName assemblyName, params string[] args)
1541 Assembly a = Assembly.Load (assemblyName, null);
1543 return ExecuteAssemblyInternal (a, args);
1547 public bool IsDefaultAppDomain ()
1549 return Object.ReferenceEquals (this, DefaultDomain);
1552 public Assembly[] ReflectionOnlyGetAssemblies ()
1554 return GetAssemblies (true);
1558 void _AppDomain.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
1560 throw new NotImplementedException ();
1563 void _AppDomain.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
1565 throw new NotImplementedException ();
1568 void _AppDomain.GetTypeInfoCount (out uint pcTInfo)
1570 throw new NotImplementedException ();
1573 void _AppDomain.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams,
1574 IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
1576 throw new NotImplementedException ();
1581 List<string> compatibility_switch;
1583 public bool? IsCompatibilitySwitchSet (string value)
1586 throw new ArgumentNullException ("value");
1588 // default (at least for SL4) is to return false for unknown values (can't get a null out of it)
1589 return ((compatibility_switch != null) && compatibility_switch.Contains (value));
1592 internal void SetCompatibilitySwitch (string value)
1594 if (compatibility_switch == null)
1595 compatibility_switch = new List<string> ();
1596 compatibility_switch.Add (value);
1599 [MonoTODO ("Currently always returns false")]
1600 public static bool MonitoringIsEnabled {
1601 get { return false; }
1602 set { throw new NotImplementedException (); }
1606 public long MonitoringSurvivedMemorySize {
1607 get { throw new NotImplementedException (); }
1611 public static long MonitoringSurvivedProcessMemorySize {
1612 get { throw new NotImplementedException (); }
1616 public long MonitoringTotalAllocatedMemorySize {
1617 get { throw new NotImplementedException (); }
1621 public TimeSpan MonitoringTotalProcessorTime {
1622 get { throw new NotImplementedException (); }