Merge pull request #496 from nicolas-raoul/unit-test-for-issue2907
[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 #if !FULL_AOT_RUNTIME
35 using System.Reflection.Emit;
36 #endif
37 using System.Globalization;
38 using System.Runtime.Remoting;
39 using System.Runtime.InteropServices;
40
41 namespace System
42 {
43         [ComVisible (true)]
44         [CLSCompliant (false)]
45         [InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
46         [Guid ("05F696DC-2B29-3663-AD8B-C4389CF2A713")]
47         public interface _AppDomain
48         {
49 #if !MOONLIGHT
50                 string BaseDirectory {get; }
51                 string DynamicDirectory {get; }
52                 Evidence Evidence {get; }
53 #endif
54                 string FriendlyName {get; }
55 #if !MOONLIGHT
56                 string RelativeSearchPath {get; }
57                 bool ShadowCopyFiles {get; }
58
59                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
60                 void AppendPrivatePath (string path);
61
62                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
63                 void ClearPrivatePath ();
64
65                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
66                 void ClearShadowCopyPath ();
67 #endif
68
69 #if !MOONLIGHT
70                 ObjectHandle CreateInstance (string assemblyName, string typeName);
71                 ObjectHandle CreateInstance (string assemblyName, string typeName, object[] activationAttributes);
72                 ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase,
73                         BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
74                         object[] activationAttributes, Evidence securityAttributes);
75
76                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName);
77                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, object[] activationAttributes);
78                 ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase,
79                         BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture,
80                         object[] activationAttributes, Evidence securityAttributes);
81 #endif
82
83 #if !FULL_AOT_RUNTIME
84                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access);
85                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, Evidence evidence);
86                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir);
87                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir, Evidence evidence);
88                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
89                         PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions);
90                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
91                         Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
92                         PermissionSet refusedPermissions);
93                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
94                         string dir, PermissionSet requiredPermissions, PermissionSet optionalPermissions, PermissionSet refusedPermissions);
95                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access,
96                         string dir, Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
97                         PermissionSet refusedPermissions);
98                 AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, string dir,
99                         Evidence evidence, PermissionSet requiredPermissions, PermissionSet optionalPermissions,
100                         PermissionSet refusedPermissions, bool isSynchronized);
101 #endif
102
103                 void DoCallBack (CrossAppDomainDelegate theDelegate);
104                 bool Equals (object other);
105
106                 int ExecuteAssembly (string assemblyFile);
107                 int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity);
108                 int ExecuteAssembly (string assemblyFile, Evidence assemblySecurity, string[] args);
109
110                 Assembly[] GetAssemblies ();
111                 object GetData (string name);
112                 int GetHashCode();
113
114 #if !NET_4_0
115                 [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
116 #endif
117 #if !MOONLIGHT
118                 object GetLifetimeService ();
119 #endif
120
121                 Type GetType ();
122
123 #if !MOONLIGHT
124                 [SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
125                 object InitializeLifetimeService ();
126 #endif
127
128                 Assembly Load (AssemblyName assemblyRef);
129                 Assembly Load (byte[] rawAssembly);
130                 Assembly Load (string assemblyString);
131                 Assembly Load (AssemblyName assemblyRef, Evidence assemblySecurity);
132                 Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore);
133                 Assembly Load (string assemblyString, Evidence assemblySecurity);
134                 Assembly Load (byte[] rawAssembly, byte[] rawSymbolStore, Evidence securityEvidence);
135
136 #if !MOONLIGHT
137                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
138                 void SetAppDomainPolicy (PolicyLevel domainPolicy);
139
140                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
141                 void SetCachePath (string s);
142 #endif
143
144                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
145                 void SetData (string name, object data);
146
147 #if !MOONLIGHT
148                 void SetPrincipalPolicy (PrincipalPolicy policy);
149
150                 [SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
151                 void SetShadowCopyPath (string s);
152
153                 void SetThreadPrincipal (IPrincipal principal);
154 #endif
155
156                 string ToString ();
157
158                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
159                 event AssemblyLoadEventHandler AssemblyLoad;
160
161                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
162                 event ResolveEventHandler AssemblyResolve;
163
164                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
165                 event EventHandler DomainUnload;
166
167                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
168                 event EventHandler ProcessExit;
169
170                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
171                 event ResolveEventHandler ResourceResolve;
172
173                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
174                 event ResolveEventHandler TypeResolve;
175
176                 [method: SecurityPermission (SecurityAction.LinkDemand, ControlAppDomain = true)]
177                 event UnhandledExceptionEventHandler UnhandledException;
178
179 #if !NET_2_1
180                 void GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId);
181
182                 void GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo);
183
184                 void GetTypeInfoCount (out uint pcTInfo);
185
186                 void Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams,
187                         IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr);
188 #endif
189         }
190 }