diff options
Diffstat (limited to 'mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs')
-rw-r--r-- | mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs index d43e25a0519..8359c7214ff 100644 --- a/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs +++ b/mcs/class/corlib/System.Runtime.Remoting.Messaging/MethodCall.cs @@ -192,11 +192,7 @@ namespace System.Runtime.Remoting.Messaging { } public LogicalCallContext LogicalCallContext { - get { - if (_callContext == null) - _callContext = new LogicalCallContext (); - return _callContext; - } + get { return _callContext; } } public MethodBase MethodBase { @@ -297,35 +293,30 @@ namespace System.Runtime.Remoting.Messaging { if (_uri != null) { Type type = RemotingServices.GetServerTypeForUri (_uri); - if (type == null) { - string sname = _typeName != null ? " (" + _typeName + ")" : ""; - throw new RemotingException ("Requested service not found" + sname + ". No receiver for uri " + _uri); - } + if (type == null) throw new RemotingException ("Requested service not found. No receiver for uri " + _uri); - if (CastTo (_typeName, type) != null) { + if (CanCastTo (_typeName, type)) { _methodBase = RemotingServices.GetMethodBaseFromName (type, _methodName, _methodSignature); - if (_methodBase == null) throw new RemotingException ("Method " + _methodName + " not found in " + type); return; } else throw new RemotingException ("Cannot cast from client type '" + _typeName + "' to server type '" + type.FullName + "'"); } _methodBase = RemotingServices.GetMethodBaseFromMethodMessage (this); - if (_methodBase == null) throw new RemotingException ("Method " + _methodName + " not found in " + TypeName); } - Type CastTo (string clientType, Type serverType) + bool CanCastTo (string clientType, Type serverType) { int i = clientType.IndexOf(','); if (i != -1) clientType = clientType.Substring (0,i).Trim(); - if (clientType == serverType.FullName) return serverType; + if (clientType == serverType.FullName) return true; // base class hierarchy Type baseType = serverType.BaseType; while (baseType != null) { - if (clientType == baseType.FullName) return baseType; + if (clientType == baseType.FullName) return true; baseType = baseType.BaseType; } @@ -333,9 +324,9 @@ namespace System.Runtime.Remoting.Messaging { Type[] interfaces = serverType.GetInterfaces(); foreach (Type itype in interfaces) - if (clientType == itype.FullName) return itype; + if (clientType == itype.FullName) return true; - return null; + return false; } [MonoTODO] |