27 private string methodName;
31 private string typeName;
33 private object[] args;
35 private Type[] instArgs;
39 private Type[] methodSignature;
47 private ServerIdentity srvID;
49 private Identity identity;
53 private bool fVarArgs;
55 private ArgMapper argMapper;
90 if (argMapper ==
null)
92 argMapper =
new ArgMapper(
this, fOut:
false);
94 return argMapper.ArgCount;
105 if (argMapper ==
null)
107 argMapper =
new ArgMapper(
this, fOut:
false);
109 return argMapper.Args;
142 if (methodSignature !=
null)
144 return methodSignature;
148 methodSignature = Message.GenerateMethodSignature(
MethodBase);
225 return GetLogicalCallContext();
229 ServerIdentity IInternalMessage.ServerIdentityObject
243 Identity IInternalMessage.IdentityObject
281 FillHeader(enumerator.
Key.ToString(), enumerator.
Value);
284 if (methodCallMessage !=
null)
299 SetObjectData(info, context);
305 uri = smuggledMsg.Uri;
306 typeName = smuggledMsg.TypeName;
307 methodName = smuggledMsg.MethodName;
308 methodSignature = (
Type[])smuggledMsg.GetMethodSignature(deserializedArgs);
309 args = smuggledMsg.GetArgs(deserializedArgs);
310 instArgs = smuggledMsg.GetInstantiation(deserializedArgs);
311 callContext = smuggledMsg.GetCallContext(deserializedArgs);
313 if (smuggledMsg.MessagePropertyCount > 0)
315 smuggledMsg.PopulateMessageProperties(
Properties, deserializedArgs);
320 internal MethodCall(
object handlerObject, BinaryMethodCallMessage smuggledMsg)
322 if (handlerObject !=
null)
324 uri = (handlerObject as string);
327 MarshalByRefObject marshalByRefObject = handlerObject as MarshalByRefObject;
328 if (marshalByRefObject !=
null)
330 srvID = (MarshalByRefObject.GetIdentity(marshalByRefObject, out
bool _) as ServerIdentity);
335 typeName = smuggledMsg.TypeName;
336 methodName = smuggledMsg.MethodName;
337 methodSignature = (
Type[])smuggledMsg.MethodSignature;
338 args = smuggledMsg.Args;
339 instArgs = smuggledMsg.InstantiationArgs;
340 callContext = smuggledMsg.LogicalCallContext;
342 if (smuggledMsg.HasProperties)
344 smuggledMsg.PopulateMessageProperties(
Properties);
354 SetObjectData(info, ctx);
366 SetObjectFromSoapData(info);
372 FillHeader(enumerator.
Name, enumerator.
Value);
378 Header[] array = context.
Context as Header[];
381 for (
int i = 0; i < array.Length; i++)
383 FillHeader(array[i].Name, array[i].Value);
388 private static Type ResolveTypeRelativeTo(
string typeName,
int offset,
int count, Type serverType)
390 Type type = ResolveTypeRelativeToBaseTypes(typeName, offset, count, serverType);
393 Type[] interfaces = serverType.GetInterfaces();
394 Type[] array = interfaces;
395 foreach (Type type2
in array)
397 string fullName = type2.FullName;
398 if (fullName.Length == count &&
string.CompareOrdinal(typeName, offset, fullName, 0, count) == 0)
407 private static Type ResolveTypeRelativeToBaseTypes(
string typeName,
int offset,
int count, Type serverType)
409 if (typeName ==
null || serverType ==
null)
413 string fullName = serverType.FullName;
414 if (fullName.Length == count &&
string.CompareOrdinal(typeName, offset, fullName, 0, count) == 0)
418 return ResolveTypeRelativeToBaseTypes(typeName, offset, count, serverType.BaseType);
421 internal Type ResolveType()
426 srvID = (IdentityHolder.CasualResolveIdentity(uri) as ServerIdentity);
430 Type lastCalledType = srvID.GetLastCalledType(typeName);
431 if (lastCalledType !=
null)
433 return lastCalledType;
436 if (
string.CompareOrdinal(typeName, 0,
"clr:", 0, 4) == 0)
440 int num2 = typeName.IndexOf(
',', num);
443 num2 = typeName.Length;
445 lastCalledType = srvID.ServerType;
446 type = ResolveTypeRelativeTo(typeName, num, num2 - num, lastCalledType);
450 type = RemotingServices.InternalGetTypeFromQualifiedTypeName(typeName);
454 srvID.SetLastCalledType(typeName, type);
469 if (!(MI ==
null) || methodName ==
null)
473 RuntimeType runtimeType = ResolveType() as RuntimeType;
474 if (methodName.Equals(".ctor"))
478 if (runtimeType ==
null)
482 if (methodSignature !=
null)
485 int num = (instArgs !=
null) ? instArgs.Length : 0;
501 for (
int i = 0; i < array.Length; i++)
513 array[num2] = methodInfo;
517 catch (ArgumentException)
525 for (
int j = 0; j < num2; j++)
534 RemotingTypeCachedData remotingTypeCachedData =
null;
535 if (instArgs ==
null)
537 remotingTypeCachedData = InternalRemotingServices.GetReflectionCachedData(runtimeType);
538 MI = remotingTypeCachedData.GetLastCalledMethod(methodName);
548 if (instArgs !=
null && instArgs.Length != 0)
550 MI = ((
MethodInfo)MI).MakeGenericMethod(instArgs);
556 ResolveOverloadedMethod(runtimeType);
558 if (MI !=
null && !flag2)
560 remotingTypeCachedData?.SetLastCalledMethod(methodName, MI);
563 if (!(MI ==
null) || !bThrowIfNotResolved)
567 throw new RemotingException(
string.Format(
CultureInfo.
CurrentCulture, Environment.GetResourceString(
"Remoting_Message_MethodMissing"), methodName, typeName));
570 private void ResolveOverloadedMethod(RuntimeType t)
577 int num = member.Length;
586 int num2 = args.Length;
588 for (
int i = 0; i < num; i++)
593 if (methodBase !=
null)
595 throw new RemotingException(Environment.GetResourceString(
"Remoting_AmbiguousMethod"));
597 methodBase = methodBase2;
600 if (methodBase !=
null)
606 private void ResolveOverloadedMethod(RuntimeType t,
string methodName,
ArrayList argNames,
ArrayList argValues)
609 int num = member.Length;
619 for (
int i = 0; i < num; i++)
623 if (parameters.Length != argValues.
Count)
628 for (
int j = 0; j < parameters.Length; j++)
635 if (type != argValues[j].GetType())
643 methodBase = methodBase2;
647 if (methodBase ==
null)
649 throw new RemotingException(Environment.GetResourceString(
"Remoting_AmbiguousMethod"));
666 methodName = info.GetString(
"__methodName");
673 for (
int i = 0; i < arrayList3.
Count; i++)
675 arrayList2.
Add(info.GetValue((
string)arrayList3[i], typeof(
object)));
677 RuntimeType runtimeType = ResolveType() as RuntimeType;
678 if (runtimeType == null)
682 ResolveOverloadedMethod(runtimeType, methodName, arrayList3, arrayList2);
688 RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(MI);
689 ParameterInfo[] parameters = reflectionCachedData.Parameters;
690 int[] marshalRequestArgMap = reflectionCachedData.MarshalRequestArgMap;
692 args =
new object[parameters.Length];
693 if (obj !=
null && obj is
bool && (
bool)obj)
698 if (num >= arrayList.
Count)
702 string text = (string)arrayList[num];
704 for (
int j = 0; j < parameters.Length; j++)
706 if (text.Equals(parameters[j].Name))
716 throw new RemotingException(Environment.GetResourceString(
"Remoting_Message_BadSerialization"));
720 if (num2 >= args.Length)
724 args[num2] =
Message.SoapCoerceArg(info.GetValue(text, typeof(
object)), parameters[num2].
ParameterType, keyToNamespaceTable);
727 throw new RemotingException(Environment.GetResourceString(
"Remoting_Message_BadSerialization"));
729 for (
int k = 0; k < arrayList.
Count; k++)
731 string name = (string)arrayList[k];
732 args[marshalRequestArgMap[k]] =
Message.SoapCoerceArg(info.GetValue(name, typeof(
object)), parameters[marshalRequestArgMap[k]].
ParameterType, keyToNamespaceTable);
734 PopulateOutArguments(reflectionCachedData);
739 private void PopulateOutArguments(RemotingMethodCachedData methodCache)
742 int[] outOnlyArgMap = methodCache.OutOnlyArgMap;
743 foreach (
int num
in outOnlyArgMap)
746 if (elementType.IsValueType)
748 args[num] = Activator.CreateInstance(elementType, nonPublic:
true);
775 return reflectionCachedData.Parameters[index].Name;
784 if (argMapper ==
null)
786 argMapper =
new ArgMapper(
this, fOut:
false);
788 return argMapper.GetArg(argNum);
797 if (argMapper ==
null)
799 argMapper =
new ArgMapper(
this, fOut:
false);
801 return argMapper.GetArgName(index);
807 if (callContext ==
null)
822 void IInternalMessage.SetURI(
string val)
830 callContext = newCallContext;
834 bool IInternalMessage.HasProperties()
844 internal void FillHeaders(Header[] h)
846 FillHeaders(h, bFromHeaderHandler:
false);
850 private void FillHeaders(Header[] h,
bool bFromHeaderHandler)
856 if (bFromHeaderHandler && fSoap)
858 foreach (Header header
in h)
860 if (header.HeaderNamespace ==
"http://schemas.microsoft.com/clr/soap/messageProperties")
862 FillHeader(header.Name, header.Value);
866 FillHeader(propertyKeyForHeader, header);
871 for (
int j = 0; j < h.Length; j++)
873 FillHeader(h[j].Name, h[j].Value);
879 internal virtual bool FillSpecialHeader(
string key,
object value)
883 if (key.Equals(
"__Uri"))
887 else if (key.Equals(
"__MethodName"))
889 methodName = (string)value;
891 else if (key.Equals(
"__MethodSignature"))
893 methodSignature = (
Type[])value;
895 else if (key.Equals(
"__TypeName"))
897 typeName = (string)value;
899 else if (key.Equals(
"__Args"))
901 args = (
object[])value;
905 if (!key.Equals(
"__CallContext"))
912 callContext.RemotingData.LogicalCallID = (string)value;
924 internal void FillHeader(
string key,
object value)
926 if (!FillSpecialHeader(key, value))
944 if (h !=
null && h.Length != 0 && h[0].
Name ==
"__methodName")
946 methodName = (string)h[0].Value;
949 array =
new Header[h.Length - 1];
950 Array.
Copy(h, 1, array, 0, h.Length - 1);
961 FillHeaders(array, bFromHeaderHandler:
true);
963 serializationMonkey._obj =
this;
966 ArgMapper argMapper =
new ArgMapper(MI, fOut:
false);
967 serializationMonkey.fieldNames = argMapper.ArgNames;
968 serializationMonkey.fieldTypes = argMapper.ArgTypes;
970 return serializationMonkey;
Obtains information about the attributes of a member and provides access to member metadata.
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Discovers the attributes of a parameter and provides access to parameter metadata.
virtual void Init()
Initializes a T:System.Runtime.Remoting.Messaging.MethodCall.
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
Describes a set of security permissions applied to code. This class cannot be inherited.
bool MoveNext()
Advances the enumerator to the next element of the collection.
string TypeName
Gets the full type name of the remote object on which the method call is being made.
abstract Type GetElementType()
When overridden in a derived class, returns the T:System.Type of the object encompassed or referred t...
int ArgCount
Gets the number of arguments passed to a method.
MethodBase MethodBase
Gets the T:System.Reflection.MethodBase of the called method.
string MethodName
Gets the name of the invoked method.
IDictionary InternalProperties
An T:System.Collections.IDictionary interface that represents a collection of the remoting message's ...
StreamingContextStates State
Gets the source or destination of the transmitted data.
Discovers the attributes of a method and provides access to method metadata.
string GetArgName(int index)
Gets the name of a method argument at a specified index.
StringComparison
Specifies the culture, case, and sort rules to be used by certain overloads of the M:System....
object Value
Gets the value of the item currently being examined.
object Key
Gets the key of the current dictionary entry.
Defines the method call message interface.
virtual int Count
Gets the number of elements actually contained in the T:System.Collections.ArrayList.
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
string GetInArgName(int index)
Gets the name of a method argument at a specified index that is not marked as an out parameter.
virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
Substitutes the elements of an array of types for the type parameters of the current generic method d...
Implements the T:System.Runtime.Remoting.Messaging.IMethodCallMessage interface to create a request m...
object GetInArg(int argNum)
Gets a method argument at a specified index that is not marked as an out parameter.
bool HasVarArgs
Gets a value that indicates whether the method can accept a variable number of arguments.
IDictionary Properties
Gets an T:System.Collections.IDictionary that represents a collection of the message's properties.
Describes the source and destination of a given serialized stream, and provides an additional caller-...
int InArgCount
Gets the number of arguments in the method call that are not marked as out parameters.
void GetObjectData(SerializationInfo info, StreamingContext context)
The M:System.Runtime.Remoting.Messaging.MethodCall.GetObjectData(System.Runtime.Serialization....
MethodCall(IMessage msg)
Initializes a new instance of the T:System.Runtime.Remoting.Messaging.MethodCall class by copying an ...
CallingConventions
Defines the valid calling conventions for a method.
SecurityAction
Specifies the security actions that can be performed using declarative security.
object GetArg(int argNum)
Gets a method argument, as an object, at a specified index.
Provides information about, and means to manipulate, the current environment and platform....
IDictionary ExternalProperties
An T:System.Collections.IDictionary interface that represents a collection of the remoting message's ...
object [] Args
Gets an array of arguments passed to a method.
Represents a collection that can contain many different types of permissions.
virtual bool IsGenericMethod
Gets a value indicating whether the method is generic.
void ResolveMethod()
Sets method information from previously initialized remoting message properties.
Represents a collection of key/value pairs that are organized based on the hash code of the key....
virtual IDictionary Properties
Gets an T:System.Collections.IDictionary interface that represents a collection of the remoting messa...
MethodCall(Header[] h1)
Initializes a new instance of the T:System.Runtime.Remoting.Messaging.MethodCall class from an array ...
MethodBase MethodBase
Gets the T:System.Reflection.MethodBase of the called method.
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Represents type declarations: class types, interface types, array types, value types,...
Defines utility methods for use by the .NET Framework remoting infrastructure.
Provides information about methods and constructors.
Indicates that data in the pipe is transmitted and read as a stream of messages.
Provides a set of properties that are carried with the execution code path during remote method calls...
Defines the method message interface.
Stores all the data needed to serialize or deserialize an object. This class cannot be inherited.
override Type [] GetGenericArguments()
Returns an array of T:System.Type objects that represent the type arguments of a generic method or th...
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
Contains communication data sent between cooperating message sinks.
LogicalCallContext LogicalCallContext
Gets the T:System.Runtime.Remoting.Messaging.LogicalCallContext for the current method call.
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
virtual int Position
Gets the zero-based position of the parameter in the formal parameter list.
void RootSetObjectData(SerializationInfo info, StreamingContext ctx)
Sets method information from serialization settings.
static void Copy(Array sourceArray, Array destinationArray, int length)
Copies a range of elements from an T:System.Array starting at the first element and pastes them into ...
Allows an object to control its own serialization and deserialization.
object MethodSignature
Gets an object that contains the method signature.
new IDictionaryEnumerator GetEnumerator()
Returns an T:System.Collections.IDictionaryEnumerator object for the T:System.Collections....
object Value
Gets the value of the current dictionary entry.
object Context
Gets context specified as part of the additional context.
Specifies that the class can be serialized.
Enumerates the elements of a nongeneric dictionary.
string Name
Gets the name for the item currently being examined.
virtual Type ParameterType
Gets the Type of this parameter.
virtual object HeaderHandler(Header[] h)
Initializes an internal serialization handler from an array of remoting headers that are applied to a...
The exception that is thrown when the security policy requires code to be type safe and the verificat...
StreamingContextStates
Defines a set of flags that specifies the source or destination context for the stream during seriali...
Provides information about a specific culture (called a locale for unmanaged code development)....
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
SecurityPermissionFlag
Specifies access flags for the security permission object.
Provides an object representation of a uniform resource identifier (URI) and easy access to the parts...
Provides several methods for using and publishing remoted objects and proxies. This class cannot be i...
MemberTypes
Marks each type of member that is defined as a derived class of T:System.Reflection....
The exception that is thrown when binding to a member results in more than one member matching the bi...
Provides a formatter-friendly mechanism for parsing the data in T:System.Runtime.Serialization....
Represents a nongeneric collection of key/value pairs.
The exception that is thrown when something has gone wrong during remoting.
object [] InArgs
Gets an array of arguments in the method call that are not marked as out parameters.
abstract ParameterInfo [] GetParameters()
When overridden in a derived class, gets the parameters of the specified method or constructor.
Implements the T:System.Collections.IList interface using an array whose size is dynamically increase...
bool MoveNext()
Updates the enumerator to the next item.