Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@@ -68,8 +68,38 @@ namespace System.Runtime.Remoting.Messaging {
internal static String CallContextKey = "__CallContext";
internal static String UriKey = "__Uri";
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern void InitMessage (MonoMethod method, object [] out_args);
internal void InitMessage (MonoMethod method, object [] out_args)
{
this.method = method;
ParameterInfo[] paramInfo = method.GetParametersInternal ();
int param_count = paramInfo.Length;
args = new object[param_count];
arg_types = new byte[param_count];
asyncResult = null;
call_type = CallType.Sync;
names = new string[param_count];
for (int i = 0; i < param_count; i++) {
names[i] = paramInfo[i].Name;
}
bool hasOutArgs = out_args != null;
int j = 0;
for (int i = 0; i < param_count; i++) {
byte arg_type;
bool isOut = paramInfo[i].IsOut;
if (paramInfo[i].ParameterType.IsByRef) {
if (hasOutArgs)
args[i] = out_args[j++];
arg_type = 2; // OUT
if (!isOut)
arg_type |= 1; // INOUT
} else {
arg_type = 1; // IN
if (isOut)
arg_type |= 4; // IN, COPY OUT
}
arg_types[i] = arg_type;
}
}
public MonoMethodMessage (MethodBase method, object [] out_args)
{
@@ -79,19 +109,30 @@ namespace System.Runtime.Remoting.Messaging {
args = null;
}
public MonoMethodMessage (Type type, string method_name, object [] in_args)
internal MonoMethodMessage (MethodInfo minfo, object [] in_args, object [] out_args)
{
// fixme: consider arg types
MethodInfo minfo = type.GetMethod (method_name);
InitMessage ((MonoMethod)minfo, null);
InitMessage ((MonoMethod)minfo, out_args);
int len = in_args.Length;
for (int i = 0; i < len; i++) {
args [i] = in_args [i];
}
}
private static MethodInfo GetMethodInfo (Type type, string methodName)
{
// fixme: consider arg types
MethodInfo minfo = type.GetMethod(methodName);
if (minfo == null)
throw new ArgumentException (String.Format("Could not find '{0}' in {1}", methodName, type), "methodName");
return minfo;
}
public MonoMethodMessage (Type type, string methodName, object [] in_args)
: this (GetMethodInfo (type, methodName), in_args, null)
{
}
public IDictionary Properties {
get {
if (properties == null) properties = new MCMDictionary (this);