copying the latest Sys.Web.Services from trunk.
[mono.git] / mcs / class / corlib / System / _AppDomain.cs
1 //
2 // System.AppDomain.cs
3 //
4 // Author:
5 //   Duco Fijma (duco@lorentz.xs4all.nl)
6 //
7 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28
29 using System.Security;
30 using System.Security.Permissions;
31 using System.Security.Policy;
32 using System.Security.Principal;
33 using System.Reflection;
34 using System.Reflection.Emit;
35 using System.Globalization;
36 using System.Runtime.Remoting;
37 using System.Runtime.InteropServices;
38
39 namespace System
40 {
41         [CLSCompliant (false)]
42         [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
43         [Guid ("05F696DC-2B29-3663-AD8B-C4389CF2A713")]
44         public interface _AppDomain
45         {
46                 string BaseDirectory {get; }
47                 string DynamicDirectory {get; }
48                 Evidence Evidence {get; }
49                 string FriendlyName {get; }
50                 string RelativeSearchPath {get; }
51                 bool ShadowCopyFiles {get; }
52
53                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
54                 void AppendPrivatePath (string path);
55
56                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
57                 void ClearPrivatePath ();
58
59                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
60                 void ClearShadowCopyPath ();
61
62                 ObjectHandle CreateInstance (string assemblyName, string typeName);
63                 ObjectHandle CreateInstance (string assemblyName, string typeName, object[] activationAttributes);
64                 ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase,
65                         BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
66                         object[] activationAttributes, Evidence securityAttribtutes);
67
68                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName);
69                 ObjectHandle CreateInstanceFrom (string assemblyName, string typeName, object[] activationAttributes);
70                 ObjectHandle CreateInstanceFrom (string assemblyName, string typeName, bool ignoreCase,
71                         BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
72                         object[] activationAttributes, Evidence securityAttribtutes);
73
74                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access);
75                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence);
76                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir);
77                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir, Evidence evidence);
78                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
79                         PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPersmissions);
80                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
81                         Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
82                         PermissionSet refusedPersmissions);
83                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
84                         string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPersmissions);
85                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
86                         string dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
87                         PermissionSet refusedPersmissions);
88                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
89                         Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
90                         PermissionSet refusedPersmissions, bool isSynchronized);
91
92                 void DoCallBack (CrossAppDomainDelegate theDelegate);
93                 bool Equals (object other);
94
95                 int ExecuteAssembly (string assemblyFile);
96                 int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity);
97                 int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args);
98
99                 Assembly[] GetAssemblies ();
100                 object GetData (string name);
101                 int GetHashCode();
102
103                 [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
104                 object GetLifetimeService ();
105
106                 Type GetType ();
107
108                 [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
109                 object InitializeLifetimeService ();
110
111                 Assembly Load (AssemblyName assemblyRef);
112                 Assembly Load (byte[] rawAssembly);
113                 Assembly Load (string assemblyString);
114                 Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity);
115                 Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore);
116                 Assembly Load (string assemblyString, Evidence assemblySecurity);
117                 Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence);
118
119                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
120                 void SetAppDomainPolicy (PolicyLevel domainPolicy);
121
122                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
123                 void SetCachePath (string s);
124
125                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
126                 void SetData (string name, object data);
127
128                 void SetPrincipalPolicy (PrincipalPolicy policy);
129
130                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
131                 void SetShadowCopyPath (string s);
132
133                 void SetThreadPrincipal (IPrincipal principal);
134                 string ToString ();
135
136 #if BOOTSTRAP_WITH_OLDLIB
137                 // older MCS/corlib returns:
138                 // _AppDomain.cs(138) error CS0592: Attribute 'SecurityPermission' is not valid on this declaration type.
139                 // It is valid on 'assembly' 'class' 'constructor' 'method' 'struct'  declarations only.
140                 event AssemblyLoadEventHandler AssemblyLoad;
141                 event ResolveEventHandler AssemblyResolve;
142                 event EventHandler DomainUnload;
143                 event EventHandler ProcessExit;
144                 event ResolveEventHandler ResourceResolve;
145                 event ResolveEventHandler TypeResolve;
146                 event UnhandledExceptionEventHandler UnhandledException;
147 #else
148                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
149                 event AssemblyLoadEventHandler AssemblyLoad;
150
151                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
152                 event ResolveEventHandler AssemblyResolve;
153
154                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
155                 event EventHandler DomainUnload;
156
157                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
158                 event EventHandler ProcessExit;
159
160                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
161                 event ResolveEventHandler ResourceResolve;
162
163                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
164                 event ResolveEventHandler TypeResolve;
165
166                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
167                 event UnhandledExceptionEventHandler UnhandledException;
168 #endif
169         }
170 }