Skip to content

Commit

Permalink
In System:
Browse files Browse the repository at this point in the history
2009-09-20  Sebastien Pouliot  <sebastien@ximian.com>

	* Activator.cs: Remove COM related method for NET_2_1
	* AppDomain.cs: Remove extra methods and properties for NET_2_1
	* AppDomainSetup.cs: Remove some properties for NET_2_1

In .:
	Remove more types (e.g. AccessControl, Soap) from NET_2_1

2009-09-20  Sebastien Pouliot  <sebastien@ximian.com>

	* net_2_1_bootstrap_corlib.dll.sources, net_2_1_raw_corlib.dll.sources:

svn path=/trunk/mcs/; revision=142296
  • Loading branch information
Sebastien Pouliot committed Sep 21, 2009
1 parent f403456 commit 350ecb9
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 281 deletions.
5 changes: 5 additions & 0 deletions mcs/class/corlib/ChangeLog
@@ -1,3 +1,8 @@
2009-09-20 Sebastien Pouliot <sebastien@ximian.com>

* net_2_1_bootstrap_corlib.dll.sources, net_2_1_raw_corlib.dll.sources:
Remove more types (e.g. AccessControl, Soap) from NET_2_1

2009-09-20 Sebastien Pouliot <sebastien@ximian.com>

* net_2_1_bootstrap_corlib.dll.sources, net_2_1_raw_corlib.dll.sources:
Expand Down
17 changes: 12 additions & 5 deletions mcs/class/corlib/System/Activator.cs
Expand Up @@ -31,14 +31,16 @@

using System.Globalization;
using System.Reflection;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security.Policy;
using System.Configuration.Assemblies;
using System.Text;
#if !NET_2_1
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
#endif

namespace System
{
Expand All @@ -58,6 +60,7 @@ private Activator ()
{
}

#if !NET_2_1
[MonoTODO ("No COM support")]
public static ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName)
{
Expand Down Expand Up @@ -201,7 +204,10 @@ public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName
throw new ArgumentNullException ("domain");
return domain.CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
#endif
#endif // !NET_2_1

#if NET_2_0
public static T CreateInstance <T> ()
{
return (T) CreateInstance (typeof (T));
Expand Down Expand Up @@ -280,7 +286,7 @@ public static object CreateInstance (Type type, object [] args, object [] activa
}

CheckAbstractType (type);

#if !NET_2_1
if (activationAttributes != null && activationAttributes.Length > 0) {
if (!type.IsMarshalByRef) {
string msg = Locale.GetText ("Type '{0}' doesn't derive from MarshalByRefObject.", type.FullName);
Expand All @@ -293,7 +299,7 @@ public static object CreateInstance (Type type, object [] args, object [] activa
return newOb;
}
}

#endif
return ctor.Invoke (bindingAttr, binder, args, culture);
}

Expand Down Expand Up @@ -355,6 +361,7 @@ private static void CheckAbstractType (Type type)
}
}

#if !NET_2_1
[SecurityPermission (SecurityAction.LinkDemand, RemotingConfiguration = true)]
public static object GetObject (Type type, string url)
{
Expand All @@ -372,7 +379,7 @@ public static object GetObject (Type type, string url, object state)

return RemotingServices.Connect (type, url, state);
}

#endif
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal static extern object CreateInstanceInternal (Type type);

Expand Down
72 changes: 48 additions & 24 deletions mcs/class/corlib/System/AppDomain.cs
Expand Up @@ -59,11 +59,16 @@ namespace System {

#if NET_2_0
[ComVisible (true)]
#if !NET_2_1
[ComDefaultInterface (typeof (_AppDomain))]
#endif
#endif
[ClassInterface(ClassInterfaceType.None)]
public sealed class AppDomain : MarshalByRefObject , _AppDomain , IEvidenceFactory
{
#if NET_2_1
public sealed class AppDomain : MarshalByRefObject {
#else
public sealed class AppDomain : MarshalByRefObject, _AppDomain, IEvidenceFactory {
#endif
#pragma warning disable 169
#region Sync with object-internals.h
IntPtr _mono_app_domain;
Expand Down Expand Up @@ -110,35 +115,31 @@ private AppDomain ()
}
}

#if NET_2_0
#if NET_2_0 && !NET_2_1
[MonoTODO]
public ApplicationTrust ApplicationTrust {
get { throw new NotImplementedException (); }
}
#endif

#if !NET_2_1
public string BaseDirectory {
get {
string path = SetupInformationNoCopy.ApplicationBase;
#if !NET_2_1
if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
// we cannot divulge local file informations
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
}
#endif
return path;
}
}

public string RelativeSearchPath {
get {
string path = SetupInformationNoCopy.PrivateBinPath;
#if !NET_2_1
if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
// we cannot divulge local file informations
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
}
#endif
return path;
}
}
Expand All @@ -150,12 +151,10 @@ private AppDomain ()
return null;

string path = Path.Combine (setup.DynamicBase, setup.ApplicationName);
#if !NET_2_1
if (SecurityManager.SecurityEnabled && (path != null) && (path.Length > 0)) {
// we cannot divulge local file informations
new FileIOPermission (FileIOPermissionAccess.PathDiscovery, path).Demand ();
}
#endif
return path;
}
}
Expand All @@ -165,6 +164,7 @@ private AppDomain ()
return (SetupInformationNoCopy.ShadowCopyFiles == "true");
}
}
#endif

[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern string getFriendlyName ();
Expand Down Expand Up @@ -248,6 +248,8 @@ private AppDomain ()
}
}

#if !NET_2_1

#if NET_2_0
[Obsolete ("AppDomain.AppendPrivatePath has been deprecated. Please investigate the use of AppDomainSetup.PrivateBinPath instead.")]
#endif
Expand Down Expand Up @@ -401,6 +403,8 @@ public object CreateInstanceFromAndUnwrap (string assemblyName, string typeName,
return (oh != null) ? oh.Unwrap () : null;
}

#endif // !NET_2_1

public AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access)
{
return DefineDynamicAssembly (name, access, null, null, null, null, null, false);
Expand Down Expand Up @@ -699,7 +703,7 @@ internal Assembly Load (byte [] rawAssembly, byte [] rawSymbolStore, Evidence se
assembly.FromByteArray = true;
return assembly;
}

#if !NET_2_1
[SecurityPermission (SecurityAction.Demand, ControlPolicy = true)]
public void SetAppDomainPolicy (PolicyLevel domainPolicy)
{
Expand Down Expand Up @@ -765,7 +769,7 @@ public void SetThreadPrincipal (IPrincipal principal)

_principal = principal;
}

#endif
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private static extern AppDomain InternalSetDomainByID (int domain_id);

Expand Down Expand Up @@ -854,6 +858,8 @@ internal static String GetProcessGuid ()
return _process_guid;
}

#if !NET_2_1

public static AppDomain CreateDomain (string friendlyName)
{
return CreateDomain (friendlyName, null, null);
Expand Down Expand Up @@ -908,7 +914,7 @@ public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo
else
ad._evidence = new Evidence (securityInfo); // copy

#if NET_2_0
#if NET_2_0 && !NET_2_1
if (info.AppDomainInitializer != null) {
if (!info.AppDomainInitializer.Method.IsStatic)
throw new ArgumentException ("Non-static methods cannot be invoked as an appdomain initializer");
Expand All @@ -927,7 +933,7 @@ public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo
return ad;
}

#if NET_2_0
#if NET_2_0 && !NET_2_1
[Serializable]
class Loader {

Expand Down Expand Up @@ -969,7 +975,7 @@ public void Initialize ()
return CreateDomain (friendlyName, securityInfo, CreateDomainSetup (appBasePath, appRelativeSearchPath, shadowCopyFiles));
}

#if NET_2_0
#if NET_2_0 && !NET_2_1
public static AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup info,
PermissionSet grantSet, params StrongName [] fullTrustAssemblies)
{
Expand Down Expand Up @@ -1000,6 +1006,7 @@ static AppDomainSetup CreateDomainSetup (string appBasePath, string appRelativeS

return info;
}
#endif // !NET_2_1

[MethodImplAttribute (MethodImplOptions.InternalCall)]
private static extern bool InternalIsFinalizingForUnload (int domain_id);
Expand Down Expand Up @@ -1043,6 +1050,7 @@ public void SetData (string name, object data, IPermission permission)
}
#endif

#if !NET_2_1
#if NET_2_0
[Obsolete ("Use AppDomainSetup.DynamicBase")]
#endif
Expand All @@ -1051,6 +1059,7 @@ public void SetDynamicBase (string path)
{
SetupInformationNoCopy.DynamicBase = path;
}
#endif // !NET_2_1

#if NET_2_0
[Obsolete ("AppDomain.GetCurrentThreadId has been deprecated"
Expand Down Expand Up @@ -1114,7 +1123,7 @@ private void DoAssemblyLoad (Assembly assembly)
private Assembly DoAssemblyResolve (string name, bool refonly)
{
ResolveEventHandler del;
#if NET_2_0
#if NET_2_0 && !NET_2_1
if (refonly)
del = ReflectionOnlyAssemblyResolve;
else
Expand Down Expand Up @@ -1205,12 +1214,13 @@ private void DoDomainUnload ()
DomainUnload(this, null);
}

#if !NET_2_1
internal byte[] GetMarshalledDomainObjRef ()
{
ObjRef oref = RemotingServices.Marshal (AppDomain.CurrentDomain, null, typeof (AppDomain));
return CADSerializer.SerializeObject (oref).GetBuffer();
}

#endif
internal void ProcessMessageInDomain (byte[] arrRequest, CADMethodCallMessage cadMsg,
out byte[] arrResponse, out CADMethodReturnMessage cadMrm)
{
Expand All @@ -1230,6 +1240,7 @@ internal byte[] GetMarshalledDomainObjRef ()
else
arrResponse = null;
}

#pragma warning restore 169

// End of methods called from the runtime
Expand Down Expand Up @@ -1282,13 +1293,23 @@ internal byte[] GetMarshalledDomainObjRef ()
#endif

#if NET_2_0
#pragma warning disable 649
private AppDomainManager _domain_manager;
#pragma warning restore 649

// default is null
public AppDomainManager DomainManager {
get { return _domain_manager; }
}
#endif

#if NET_2_0 && !NET_2_1

public event ResolveEventHandler ReflectionOnlyAssemblyResolve;

#pragma warning disable 649
private ActivationContext _activation;
private ApplicationIdentity _applicationIdentity;
private AppDomainManager _domain_manager;
#pragma warning restore 649

// properties
Expand All @@ -1301,11 +1322,6 @@ internal byte[] GetMarshalledDomainObjRef ()
get { return _applicationIdentity; }
}

// default is null
public AppDomainManager DomainManager {
get { return _domain_manager; }
}

public int Id {
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
get { return getDomainID (); }
Expand Down Expand Up @@ -1372,7 +1388,15 @@ public Assembly[] ReflectionOnlyGetAssemblies ()
}
#endif

#if NET_1_1
#if NET_2_1
public int ExecuteAssemblyByName (string assemblyName)
{
// critical code in SL that we're not calling in ML
throw new NotImplementedException ();
}
#endif

#if NET_1_1 && !NET_2_1
void _AppDomain.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException ();
Expand Down

0 comments on commit 350ecb9

Please sign in to comment.