Imported Upstream version 4.2.0.179

Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
Xamarin Public Jenkins
2015-08-26 07:17:56 -04:00
committed by Jo Shields
parent 183bba2c9a
commit 6992685b86
7507 changed files with 90259 additions and 657307 deletions

View File

@@ -34,6 +34,7 @@
//
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Messaging;
@@ -64,14 +65,34 @@ namespace System.Runtime.Remoting {
UpdateChannelInfo();
}
internal ObjRef (string typeName, string uri, IChannelInfo cinfo)
internal ObjRef (string uri, IChannelInfo cinfo)
{
this.uri = uri;
channel_info = cinfo;
typeInfo = new TypeInfo (Type.GetType (typeName, true));
this.channel_info = cinfo;
}
internal ObjRef (ObjRef o, bool unmarshalAsProxy) {
internal ObjRef DeserializeInTheCurrentDomain (int domainId, byte[] tInfo)
{
string local_uri = string.Copy (this.uri);
ChannelInfo cinfo = new ChannelInfo (new CrossAppDomainData (domainId));
ObjRef res = new ObjRef (local_uri, cinfo);
IRemotingTypeInfo typeInfo = (IRemotingTypeInfo)CADSerializer.DeserializeObjectSafe (tInfo);
res.typeInfo = typeInfo;
return res;
}
internal byte[] SerializeType ()
{
// FIXME: Assert self and typeinfo in same domain
if (typeInfo == null)
throw new Exception ("Attempt to serialize a null TypeInfo.");
MemoryStream stm = CADSerializer.SerializeObject (typeInfo);
return stm.GetBuffer ();
}
internal ObjRef (ObjRef o, bool unmarshalAsProxy)
{
channel_info = o.channel_info;
uri = o.uri;
@@ -260,5 +281,9 @@ namespace System.Runtime.Remoting {
return _serverType;
}
}
internal void SetDomainID (int id)
{
}
}
}

View File

@@ -109,6 +109,12 @@ namespace System.Runtime.Remoting
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public extern static bool IsTransparentProxy (object proxy);
internal static bool ProxyCheckCast (RealProxy rp, RuntimeType castType)
{
// TODO: What should it do?
return true;
}
#endif
internal static IMethodReturnMessage InternalExecuteMessage (
@@ -136,7 +142,7 @@ namespace System.Runtime.Remoting
method = gmd.MakeGenericMethod (genericArguments);
}
object oldContext = CallContext.SetCurrentCallContext (reqMsg.LogicalCallContext);
var oldContext = CallContext.SetLogicalCallContext (reqMsg.LogicalCallContext);
try
{
@@ -162,14 +168,15 @@ namespace System.Runtime.Remoting
returnArgs [n++] = null;
}
result = new ReturnMessage (rval, returnArgs, n, ExecutionContext.CreateLogicalCallContext (true), reqMsg);
var latestCallContext = Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext;
result = new ReturnMessage (rval, returnArgs, n, latestCallContext, reqMsg);
}
catch (Exception e)
{
result = new ReturnMessage (e, reqMsg);
}
CallContext.RestoreCallContext (oldContext);
CallContext.SetLogicalCallContext (oldContext);
return result;
}
@@ -763,11 +770,11 @@ namespace System.Runtime.Remoting
[SecurityPermission (SecurityAction.Assert, SerializationFormatter = true)] // FIXME: to be reviewed
internal static byte[] SerializeCallData (object obj)
{
LogicalCallContext ctx = ExecutionContext.CreateLogicalCallContext (false);
if (ctx != null) {
var ctx = Thread.CurrentThread.GetExecutionContextReader().LogicalCallContext;
if (!ctx.IsNull) {
CACD cad = new CACD ();
cad.d = obj;
cad.c = ctx;
cad.c = ctx.Clone ();
obj = cad;
}
@@ -789,7 +796,10 @@ namespace System.Runtime.Remoting
if (obj is CACD) {
CACD cad = (CACD) obj;
obj = cad.d;
CallContext.UpdateCurrentLogicalCallContext ((LogicalCallContext) cad.c);
var lcc = (LogicalCallContext) cad.c;
if (lcc.HasInfo)
Thread.CurrentThread.GetMutableExecutionContext().LogicalCallContext.Merge (lcc);
}
return obj;
}

View File

@@ -56,7 +56,7 @@ namespace System.Runtime.Remoting
int baseCount = 0;
Type baseType = type.BaseType;
while (baseType != typeof (MarshalByRefObject) && baseType != typeof(object))
while (baseType != typeof (MarshalByRefObject) && baseType != null)
{
baseType = baseType.BaseType;
baseCount++;