diff options
Diffstat (limited to 'mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs')
-rw-r--r-- | mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs | 56 |
1 files changed, 13 insertions, 43 deletions
diff --git a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs index 6d4b810ed13..aa694cbb3b6 100644 --- a/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs +++ b/mcs/class/corlib/System.Runtime.Remoting/RemotingServices.cs @@ -57,7 +57,6 @@ namespace System.Runtime.Remoting internal static string app_id; static int next_id = 1; - static readonly BindingFlags methodBindings = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; static RemotingServices () { @@ -160,10 +159,8 @@ namespace System.Runtime.Remoting else throw new ArgumentException ("The obj parameter is a proxy."); } - else { + else identity = obj.ObjectIdentity; - obj.ObjectIdentity = null; - } if (identity == null || !identity.IsConnected) return false; @@ -291,49 +288,22 @@ namespace System.Runtime.Remoting Type type = Type.GetType (msg.TypeName); if (type == null) throw new RemotingException ("Type '" + msg.TypeName + "' not found."); - - return GetMethodBaseFromName (type, msg.MethodName, (Type[]) msg.MethodSignature); - } - - internal static MethodBase GetMethodBaseFromName (Type type, string methodName, Type[] signature) - { - if (type.IsInterface) { - return FindInterfaceMethod (type, methodName, signature); - } - else { - MethodBase method = null; - if (signature == null) - method = type.GetMethod (methodName, methodBindings); - else - method = type.GetMethod (methodName, methodBindings, null, (Type[]) signature, null); - - if (method != null) - return method; - - if (signature == null) - return type.GetConstructor (methodBindings, null, Type.EmptyTypes, null); - else - return type.GetConstructor (methodBindings, null, signature, null); - } - } - - static MethodBase FindInterfaceMethod (Type type, string methodName, Type[] signature) - { - MethodBase method = null; + + BindingFlags bflags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; - if (signature == null) - method = type.GetMethod (methodName, methodBindings); + MethodBase method; + if (msg.MethodSignature == null) + method = type.GetMethod (msg.MethodName, bflags); else - method = type.GetMethod (methodName, methodBindings, null, signature, null); - - if (method != null) return method; + method = type.GetMethod (msg.MethodName, bflags, null, (Type[]) msg.MethodSignature, null); - foreach (Type t in type.GetInterfaces ()) { - method = FindInterfaceMethod (t, methodName, signature); - if (method != null) return method; - } + if (method != null) + return method; - return null; + if (msg.MethodSignature == null) + return type.GetConstructor (bflags, null, Type.EmptyTypes, null); + else + return type.GetConstructor (bflags, null, (Type[]) msg.MethodSignature, null); } public static void GetObjectData(object obj, SerializationInfo info, StreamingContext context) |