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