mscorlib(4.0.0.0) API with additions
MethodCall.cs
1 using System.Collections;
3 using System.Reflection;
8 using System.Security;
10 
12 {
14  [Serializable]
15  [SecurityCritical]
16  [CLSCompliant(false)]
17  [ComVisible(true)]
18  [SecurityPermission(SecurityAction.InheritanceDemand, Flags = SecurityPermissionFlag.Infrastructure)]
19  public class MethodCall : IMethodCallMessage, IMethodMessage, IMessage, ISerializable, IInternalMessage, ISerializationRootObject
20  {
21  private const BindingFlags LookupAll = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
22 
23  private const BindingFlags LookupPublic = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
24 
25  private string uri;
26 
27  private string methodName;
28 
29  private MethodBase MI;
30 
31  private string typeName;
32 
33  private object[] args;
34 
35  private Type[] instArgs;
36 
37  private LogicalCallContext callContext;
38 
39  private Type[] methodSignature;
40 
43 
46 
47  private ServerIdentity srvID;
48 
49  private Identity identity;
50 
51  private bool fSoap;
52 
53  private bool fVarArgs;
54 
55  private ArgMapper argMapper;
56 
59  public int ArgCount
60  {
61  [SecurityCritical]
62  get
63  {
64  if (args != null)
65  {
66  return args.Length;
67  }
68  return 0;
69  }
70  }
71 
74  public object[] Args
75  {
76  [SecurityCritical]
77  get
78  {
79  return args;
80  }
81  }
82 
85  public int InArgCount
86  {
87  [SecurityCritical]
88  get
89  {
90  if (argMapper == null)
91  {
92  argMapper = new ArgMapper(this, fOut: false);
93  }
94  return argMapper.ArgCount;
95  }
96  }
97 
100  public object[] InArgs
101  {
102  [SecurityCritical]
103  get
104  {
105  if (argMapper == null)
106  {
107  argMapper = new ArgMapper(this, fOut: false);
108  }
109  return argMapper.Args;
110  }
111  }
112 
115  public string MethodName
116  {
117  [SecurityCritical]
118  get
119  {
120  return methodName;
121  }
122  }
123 
126  public string TypeName
127  {
128  [SecurityCritical]
129  get
130  {
131  return typeName;
132  }
133  }
134 
137  public object MethodSignature
138  {
139  [SecurityCritical]
140  get
141  {
142  if (methodSignature != null)
143  {
144  return methodSignature;
145  }
146  if (MI != null)
147  {
148  methodSignature = Message.GenerateMethodSignature(MethodBase);
149  }
150  return null;
151  }
152  }
153 
156  public MethodBase MethodBase
157  {
158  [SecurityCritical]
159  get
160  {
161  if (MI == null)
162  {
163  MI = RemotingServices.InternalGetMethodBaseFromMethodMessage(this);
164  }
165  return MI;
166  }
167  }
168 
171  public string Uri
172  {
173  [SecurityCritical]
174  get
175  {
176  return uri;
177  }
178  set
179  {
180  uri = value;
181  }
182  }
183 
187  public bool HasVarArgs
188  {
189  [SecurityCritical]
190  get
191  {
192  return fVarArgs;
193  }
194  }
195 
198  public virtual IDictionary Properties
199  {
200  [SecurityCritical]
201  get
202  {
203  lock (this)
204  {
205  if (InternalProperties == null)
206  {
208  }
209  if (ExternalProperties == null)
210  {
211  ExternalProperties = new MCMDictionary(this, InternalProperties);
212  }
213  return ExternalProperties;
214  }
215  }
216  }
217 
221  {
222  [SecurityCritical]
223  get
224  {
225  return GetLogicalCallContext();
226  }
227  }
228 
229  ServerIdentity IInternalMessage.ServerIdentityObject
230  {
231  [SecurityCritical]
232  get
233  {
234  return srvID;
235  }
236  [SecurityCritical]
237  set
238  {
239  srvID = value;
240  }
241  }
242 
243  Identity IInternalMessage.IdentityObject
244  {
245  [SecurityCritical]
246  get
247  {
248  return identity;
249  }
250  [SecurityCritical]
251  set
252  {
253  identity = value;
254  }
255  }
256 
259  [SecurityCritical]
260  public MethodCall(Header[] h1)
261  {
262  Init();
263  fSoap = true;
264  FillHeaders(h1);
265  ResolveMethod();
266  }
267 
270  [SecurityCritical]
271  public MethodCall(IMessage msg)
272  {
273  if (msg == null)
274  {
275  throw new ArgumentNullException("msg");
276  }
277  Init();
279  while (enumerator.MoveNext())
280  {
281  FillHeader(enumerator.Key.ToString(), enumerator.Value);
282  }
283  IMethodCallMessage methodCallMessage = msg as IMethodCallMessage;
284  if (methodCallMessage != null)
285  {
286  MI = methodCallMessage.MethodBase;
287  }
288  ResolveMethod();
289  }
290 
291  [SecurityCritical]
292  internal MethodCall(SerializationInfo info, StreamingContext context)
293  {
294  if (info == null)
295  {
296  throw new ArgumentNullException("info");
297  }
298  Init();
299  SetObjectData(info, context);
300  }
301 
302  [SecurityCritical]
303  internal MethodCall(SmuggledMethodCallMessage smuggledMsg, ArrayList deserializedArgs)
304  {
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);
312  ResolveMethod();
313  if (smuggledMsg.MessagePropertyCount > 0)
314  {
315  smuggledMsg.PopulateMessageProperties(Properties, deserializedArgs);
316  }
317  }
318 
319  [SecurityCritical]
320  internal MethodCall(object handlerObject, BinaryMethodCallMessage smuggledMsg)
321  {
322  if (handlerObject != null)
323  {
324  uri = (handlerObject as string);
325  if (uri == null)
326  {
327  MarshalByRefObject marshalByRefObject = handlerObject as MarshalByRefObject;
328  if (marshalByRefObject != null)
329  {
330  srvID = (MarshalByRefObject.GetIdentity(marshalByRefObject, out bool _) as ServerIdentity);
331  uri = srvID.URI;
332  }
333  }
334  }
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;
341  ResolveMethod();
342  if (smuggledMsg.HasProperties)
343  {
344  smuggledMsg.PopulateMessageProperties(Properties);
345  }
346  }
347 
351  [SecurityCritical]
353  {
354  SetObjectData(info, ctx);
355  }
356 
357  [SecurityCritical]
358  internal void SetObjectData(SerializationInfo info, StreamingContext context)
359  {
360  if (info == null)
361  {
362  throw new ArgumentNullException("info");
363  }
364  if (fSoap)
365  {
366  SetObjectFromSoapData(info);
367  return;
368  }
369  SerializationInfoEnumerator enumerator = info.GetEnumerator();
370  while (enumerator.MoveNext())
371  {
372  FillHeader(enumerator.Name, enumerator.Value);
373  }
374  if (context.State != StreamingContextStates.Remoting || context.Context == null)
375  {
376  return;
377  }
378  Header[] array = context.Context as Header[];
379  if (array != null)
380  {
381  for (int i = 0; i < array.Length; i++)
382  {
383  FillHeader(array[i].Name, array[i].Value);
384  }
385  }
386  }
387 
388  private static Type ResolveTypeRelativeTo(string typeName, int offset, int count, Type serverType)
389  {
390  Type type = ResolveTypeRelativeToBaseTypes(typeName, offset, count, serverType);
391  if (type == null)
392  {
393  Type[] interfaces = serverType.GetInterfaces();
394  Type[] array = interfaces;
395  foreach (Type type2 in array)
396  {
397  string fullName = type2.FullName;
398  if (fullName.Length == count && string.CompareOrdinal(typeName, offset, fullName, 0, count) == 0)
399  {
400  return type2;
401  }
402  }
403  }
404  return type;
405  }
406 
407  private static Type ResolveTypeRelativeToBaseTypes(string typeName, int offset, int count, Type serverType)
408  {
409  if (typeName == null || serverType == null)
410  {
411  return null;
412  }
413  string fullName = serverType.FullName;
414  if (fullName.Length == count && string.CompareOrdinal(typeName, offset, fullName, 0, count) == 0)
415  {
416  return serverType;
417  }
418  return ResolveTypeRelativeToBaseTypes(typeName, offset, count, serverType.BaseType);
419  }
420 
421  internal Type ResolveType()
422  {
423  Type type = null;
424  if (srvID == null)
425  {
426  srvID = (IdentityHolder.CasualResolveIdentity(uri) as ServerIdentity);
427  }
428  if (srvID != null)
429  {
430  Type lastCalledType = srvID.GetLastCalledType(typeName);
431  if (lastCalledType != null)
432  {
433  return lastCalledType;
434  }
435  int num = 0;
436  if (string.CompareOrdinal(typeName, 0, "clr:", 0, 4) == 0)
437  {
438  num = 4;
439  }
440  int num2 = typeName.IndexOf(',', num);
441  if (num2 == -1)
442  {
443  num2 = typeName.Length;
444  }
445  lastCalledType = srvID.ServerType;
446  type = ResolveTypeRelativeTo(typeName, num, num2 - num, lastCalledType);
447  }
448  if (type == null)
449  {
450  type = RemotingServices.InternalGetTypeFromQualifiedTypeName(typeName);
451  }
452  if (srvID != null)
453  {
454  srvID.SetLastCalledType(typeName, type);
455  }
456  return type;
457  }
458 
460  [SecurityCritical]
461  public void ResolveMethod()
462  {
463  ResolveMethod(bThrowIfNotResolved: true);
464  }
465 
466  [SecurityCritical]
467  internal void ResolveMethod(bool bThrowIfNotResolved)
468  {
469  if (!(MI == null) || methodName == null)
470  {
471  return;
472  }
473  RuntimeType runtimeType = ResolveType() as RuntimeType;
474  if (methodName.Equals(".ctor"))
475  {
476  return;
477  }
478  if (runtimeType == null)
479  {
480  throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"), typeName));
481  }
482  if (methodSignature != null)
483  {
484  bool flag = false;
485  int num = (instArgs != null) ? instArgs.Length : 0;
486  if (num == 0)
487  {
488  try
489  {
490  MI = runtimeType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, CallingConventions.Any, methodSignature, null);
491  flag = true;
492  }
494  {
495  }
496  }
497  if (!flag)
498  {
499  MemberInfo[] array = runtimeType.FindMembers(MemberTypes.Method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, Type.FilterName, methodName);
500  int num2 = 0;
501  for (int i = 0; i < array.Length; i++)
502  {
503  try
504  {
505  MethodInfo methodInfo = (MethodInfo)array[i];
506  int num3 = methodInfo.IsGenericMethod ? methodInfo.GetGenericArguments().Length : 0;
507  if (num3 == num)
508  {
509  if (num > 0)
510  {
511  methodInfo = methodInfo.MakeGenericMethod(instArgs);
512  }
513  array[num2] = methodInfo;
514  num2++;
515  }
516  }
517  catch (ArgumentException)
518  {
519  }
520  catch (VerificationException)
521  {
522  }
523  }
524  MethodInfo[] array2 = new MethodInfo[num2];
525  for (int j = 0; j < num2; j++)
526  {
527  array2[j] = (MethodInfo)array[j];
528  }
529  MI = Type.DefaultBinder.SelectMethod(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, array2, methodSignature, null);
530  }
531  }
532  else
533  {
534  RemotingTypeCachedData remotingTypeCachedData = null;
535  if (instArgs == null)
536  {
537  remotingTypeCachedData = InternalRemotingServices.GetReflectionCachedData(runtimeType);
538  MI = remotingTypeCachedData.GetLastCalledMethod(methodName);
539  if (MI != null)
540  {
541  return;
542  }
543  }
544  bool flag2 = false;
545  try
546  {
547  MI = runtimeType.GetMethod(methodName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
548  if (instArgs != null && instArgs.Length != 0)
549  {
550  MI = ((MethodInfo)MI).MakeGenericMethod(instArgs);
551  }
552  }
554  {
555  flag2 = true;
556  ResolveOverloadedMethod(runtimeType);
557  }
558  if (MI != null && !flag2)
559  {
560  remotingTypeCachedData?.SetLastCalledMethod(methodName, MI);
561  }
562  }
563  if (!(MI == null) || !bThrowIfNotResolved)
564  {
565  return;
566  }
567  throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), methodName, typeName));
568  }
569 
570  private void ResolveOverloadedMethod(RuntimeType t)
571  {
572  if (args == null)
573  {
574  return;
575  }
576  MemberInfo[] member = t.GetMember(methodName, MemberTypes.Method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
577  int num = member.Length;
578  switch (num)
579  {
580  case 0:
581  return;
582  case 1:
583  MI = (member[0] as MethodBase);
584  return;
585  }
586  int num2 = args.Length;
587  MethodBase methodBase = null;
588  for (int i = 0; i < num; i++)
589  {
590  MethodBase methodBase2 = member[i] as MethodBase;
591  if (methodBase2.GetParameters().Length == num2)
592  {
593  if (methodBase != null)
594  {
595  throw new RemotingException(Environment.GetResourceString("Remoting_AmbiguousMethod"));
596  }
597  methodBase = methodBase2;
598  }
599  }
600  if (methodBase != null)
601  {
602  MI = methodBase;
603  }
604  }
605 
606  private void ResolveOverloadedMethod(RuntimeType t, string methodName, ArrayList argNames, ArrayList argValues)
607  {
608  MemberInfo[] member = t.GetMember(methodName, MemberTypes.Method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public);
609  int num = member.Length;
610  switch (num)
611  {
612  case 0:
613  return;
614  case 1:
615  MI = (member[0] as MethodBase);
616  return;
617  }
618  MethodBase methodBase = null;
619  for (int i = 0; i < num; i++)
620  {
621  MethodBase methodBase2 = member[i] as MethodBase;
622  ParameterInfo[] parameters = methodBase2.GetParameters();
623  if (parameters.Length != argValues.Count)
624  {
625  continue;
626  }
627  bool flag = true;
628  for (int j = 0; j < parameters.Length; j++)
629  {
630  Type type = parameters[j].ParameterType;
631  if (type.IsByRef)
632  {
633  type = type.GetElementType();
634  }
635  if (type != argValues[j].GetType())
636  {
637  flag = false;
638  break;
639  }
640  }
641  if (flag)
642  {
643  methodBase = methodBase2;
644  break;
645  }
646  }
647  if (methodBase == null)
648  {
649  throw new RemotingException(Environment.GetResourceString("Remoting_AmbiguousMethod"));
650  }
651  MI = methodBase;
652  }
653 
657  [SecurityCritical]
659  {
660  throw new NotSupportedException(Environment.GetResourceString("NotSupported_Method"));
661  }
662 
663  [SecurityCritical]
664  internal void SetObjectFromSoapData(SerializationInfo info)
665  {
666  methodName = info.GetString("__methodName");
667  ArrayList arrayList = (ArrayList)info.GetValue("__paramNameList", typeof(ArrayList));
668  Hashtable keyToNamespaceTable = (Hashtable)info.GetValue("__keyToNamespaceTable", typeof(Hashtable));
669  if (MI == null)
670  {
671  ArrayList arrayList2 = new ArrayList();
672  ArrayList arrayList3 = arrayList;
673  for (int i = 0; i < arrayList3.Count; i++)
674  {
675  arrayList2.Add(info.GetValue((string)arrayList3[i], typeof(object)));
676  }
677  RuntimeType runtimeType = ResolveType() as RuntimeType;
678  if (runtimeType == null)
679  {
680  throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_BadType"), typeName));
681  }
682  ResolveOverloadedMethod(runtimeType, methodName, arrayList3, arrayList2);
683  if (MI == null)
684  {
685  throw new RemotingException(string.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Remoting_Message_MethodMissing"), methodName, typeName));
686  }
687  }
688  RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(MI);
689  ParameterInfo[] parameters = reflectionCachedData.Parameters;
690  int[] marshalRequestArgMap = reflectionCachedData.MarshalRequestArgMap;
691  object obj = (InternalProperties == null) ? null : InternalProperties["__UnorderedParams"];
692  args = new object[parameters.Length];
693  if (obj != null && obj is bool && (bool)obj)
694  {
695  int num = 0;
696  while (true)
697  {
698  if (num >= arrayList.Count)
699  {
700  return;
701  }
702  string text = (string)arrayList[num];
703  int num2 = -1;
704  for (int j = 0; j < parameters.Length; j++)
705  {
706  if (text.Equals(parameters[j].Name))
707  {
708  num2 = parameters[j].Position;
709  break;
710  }
711  }
712  if (num2 == -1)
713  {
714  if (!text.StartsWith("__param", StringComparison.Ordinal))
715  {
716  throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization"));
717  }
718  num2 = int.Parse(text.Substring(7), CultureInfo.InvariantCulture);
719  }
720  if (num2 >= args.Length)
721  {
722  break;
723  }
724  args[num2] = Message.SoapCoerceArg(info.GetValue(text, typeof(object)), parameters[num2].ParameterType, keyToNamespaceTable);
725  num++;
726  }
727  throw new RemotingException(Environment.GetResourceString("Remoting_Message_BadSerialization"));
728  }
729  for (int k = 0; k < arrayList.Count; k++)
730  {
731  string name = (string)arrayList[k];
732  args[marshalRequestArgMap[k]] = Message.SoapCoerceArg(info.GetValue(name, typeof(object)), parameters[marshalRequestArgMap[k]].ParameterType, keyToNamespaceTable);
733  }
734  PopulateOutArguments(reflectionCachedData);
735  }
736 
737  [SecurityCritical]
738  [PermissionSet(SecurityAction.Assert, Unrestricted = true)]
739  private void PopulateOutArguments(RemotingMethodCachedData methodCache)
740  {
741  ParameterInfo[] parameters = methodCache.Parameters;
742  int[] outOnlyArgMap = methodCache.OutOnlyArgMap;
743  foreach (int num in outOnlyArgMap)
744  {
745  Type elementType = parameters[num].ParameterType.GetElementType();
746  if (elementType.IsValueType)
747  {
748  args[num] = Activator.CreateInstance(elementType, nonPublic: true);
749  }
750  }
751  }
752 
754  public virtual void Init()
755  {
756  }
757 
761  [SecurityCritical]
762  public object GetArg(int argNum)
763  {
764  return args[argNum];
765  }
766 
770  [SecurityCritical]
771  public string GetArgName(int index)
772  {
773  ResolveMethod();
774  RemotingMethodCachedData reflectionCachedData = InternalRemotingServices.GetReflectionCachedData(MI);
775  return reflectionCachedData.Parameters[index].Name;
776  }
777 
781  [SecurityCritical]
782  public object GetInArg(int argNum)
783  {
784  if (argMapper == null)
785  {
786  argMapper = new ArgMapper(this, fOut: false);
787  }
788  return argMapper.GetArg(argNum);
789  }
790 
794  [SecurityCritical]
795  public string GetInArgName(int index)
796  {
797  if (argMapper == null)
798  {
799  argMapper = new ArgMapper(this, fOut: false);
800  }
801  return argMapper.GetArgName(index);
802  }
803 
804  [SecurityCritical]
805  internal LogicalCallContext GetLogicalCallContext()
806  {
807  if (callContext == null)
808  {
809  callContext = new LogicalCallContext();
810  }
811  return callContext;
812  }
813 
814  internal LogicalCallContext SetLogicalCallContext(LogicalCallContext ctx)
815  {
816  LogicalCallContext result = callContext;
817  callContext = ctx;
818  return result;
819  }
820 
821  [SecurityCritical]
822  void IInternalMessage.SetURI(string val)
823  {
824  uri = val;
825  }
826 
827  [SecurityCritical]
828  void IInternalMessage.SetCallContext(LogicalCallContext newCallContext)
829  {
830  callContext = newCallContext;
831  }
832 
833  [SecurityCritical]
834  bool IInternalMessage.HasProperties()
835  {
836  if (ExternalProperties == null)
837  {
838  return InternalProperties != null;
839  }
840  return true;
841  }
842 
843  [SecurityCritical]
844  internal void FillHeaders(Header[] h)
845  {
846  FillHeaders(h, bFromHeaderHandler: false);
847  }
848 
849  [SecurityCritical]
850  private void FillHeaders(Header[] h, bool bFromHeaderHandler)
851  {
852  if (h == null)
853  {
854  return;
855  }
856  if (bFromHeaderHandler && fSoap)
857  {
858  foreach (Header header in h)
859  {
860  if (header.HeaderNamespace == "http://schemas.microsoft.com/clr/soap/messageProperties")
861  {
862  FillHeader(header.Name, header.Value);
863  continue;
864  }
865  string propertyKeyForHeader = LogicalCallContext.GetPropertyKeyForHeader(header);
866  FillHeader(propertyKeyForHeader, header);
867  }
868  }
869  else
870  {
871  for (int j = 0; j < h.Length; j++)
872  {
873  FillHeader(h[j].Name, h[j].Value);
874  }
875  }
876  }
877 
878  [SecurityCritical]
879  internal virtual bool FillSpecialHeader(string key, object value)
880  {
881  if (key != null)
882  {
883  if (key.Equals("__Uri"))
884  {
885  uri = (string)value;
886  }
887  else if (key.Equals("__MethodName"))
888  {
889  methodName = (string)value;
890  }
891  else if (key.Equals("__MethodSignature"))
892  {
893  methodSignature = (Type[])value;
894  }
895  else if (key.Equals("__TypeName"))
896  {
897  typeName = (string)value;
898  }
899  else if (key.Equals("__Args"))
900  {
901  args = (object[])value;
902  }
903  else
904  {
905  if (!key.Equals("__CallContext"))
906  {
907  return false;
908  }
909  if (value is string)
910  {
911  callContext = new LogicalCallContext();
912  callContext.RemotingData.LogicalCallID = (string)value;
913  }
914  else
915  {
916  callContext = (LogicalCallContext)value;
917  }
918  }
919  }
920  return true;
921  }
922 
923  [SecurityCritical]
924  internal void FillHeader(string key, object value)
925  {
926  if (!FillSpecialHeader(key, value))
927  {
928  if (InternalProperties == null)
929  {
931  }
932  InternalProperties[key] = value;
933  }
934  }
935 
939  [SecurityCritical]
940  public virtual object HeaderHandler(Header[] h)
941  {
942  SerializationMonkey serializationMonkey = (SerializationMonkey)FormatterServices.GetUninitializedObject(typeof(SerializationMonkey));
943  Header[] array = null;
944  if (h != null && h.Length != 0 && h[0].Name == "__methodName")
945  {
946  methodName = (string)h[0].Value;
947  if (h.Length > 1)
948  {
949  array = new Header[h.Length - 1];
950  Array.Copy(h, 1, array, 0, h.Length - 1);
951  }
952  else
953  {
954  array = null;
955  }
956  }
957  else
958  {
959  array = h;
960  }
961  FillHeaders(array, bFromHeaderHandler: true);
962  ResolveMethod(bThrowIfNotResolved: false);
963  serializationMonkey._obj = this;
964  if (MI != null)
965  {
966  ArgMapper argMapper = new ArgMapper(MI, fOut: false);
967  serializationMonkey.fieldNames = argMapper.ArgNames;
968  serializationMonkey.fieldTypes = argMapper.ArgTypes;
969  }
970  return serializationMonkey;
971  }
972  }
973 }
Obtains information about the attributes of a member and provides access to member metadata.
Definition: MemberInfo.cs:14
static CultureInfo InvariantCulture
Gets the T:System.Globalization.CultureInfo object that is culture-independent (invariant).
Definition: CultureInfo.cs:263
Discovers the attributes of a parameter and provides access to parameter metadata.
virtual void Init()
Initializes a T:System.Runtime.Remoting.Messaging.MethodCall.
Definition: MethodCall.cs:754
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.
Definition: MethodCall.cs:127
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.
Definition: MethodCall.cs:60
MethodBase MethodBase
Gets the T:System.Reflection.MethodBase of the called method.
string MethodName
Gets the name of the invoked method.
Definition: MethodCall.cs:116
IDictionary InternalProperties
An T:System.Collections.IDictionary interface that represents a collection of the remoting message's ...
Definition: MethodCall.cs:45
StreamingContextStates State
Gets the source or destination of the transmitted data.
static object GetUninitializedObject(Type type)
Creates a new instance of the specified object type.
Discovers the attributes of a method and provides access to method metadata.
Definition: MethodInfo.cs:13
string GetArgName(int index)
Gets the name of a method argument at a specified index.
Definition: MethodCall.cs:771
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.
Definition: ArrayList.cs:2255
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
Definition: BindingFlags.cs:10
Definition: __Canon.cs:3
string GetInArgName(int index)
Gets the name of a method argument at a specified index that is not marked as an out parameter.
Definition: MethodCall.cs:795
virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
Substitutes the elements of an array of types for the type parameters of the current generic method d...
Definition: MethodInfo.cs:134
Implements the T:System.Runtime.Remoting.Messaging.IMethodCallMessage interface to create a request m...
Definition: MethodCall.cs:19
string Name
Contains the name of the T:System.Runtime.Remoting.Messaging.Header.
Definition: Header.cs:11
object GetInArg(int argNum)
Gets a method argument at a specified index that is not marked as an out parameter.
Definition: MethodCall.cs:782
bool HasVarArgs
Gets a value that indicates whether the method can accept a variable number of arguments.
Definition: MethodCall.cs:188
IDictionary Properties
Gets an T:System.Collections.IDictionary that represents a collection of the message's properties.
Definition: IMessage.cs:15
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.
Definition: MethodCall.cs:86
void GetObjectData(SerializationInfo info, StreamingContext context)
The M:System.Runtime.Remoting.Messaging.MethodCall.GetObjectData(System.Runtime.Serialization....
Definition: MethodCall.cs:658
MethodCall(IMessage msg)
Initializes a new instance of the T:System.Runtime.Remoting.Messaging.MethodCall class by copying an ...
Definition: MethodCall.cs:271
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.
Definition: MethodCall.cs:762
Provides information about, and means to manipulate, the current environment and platform....
Definition: Environment.cs:21
IDictionary ExternalProperties
An T:System.Collections.IDictionary interface that represents a collection of the remoting message's ...
Definition: MethodCall.cs:42
object [] Args
Gets an array of arguments passed to a method.
Definition: MethodCall.cs:75
Represents a collection that can contain many different types of permissions.
virtual bool IsGenericMethod
Gets a value indicating whether the method is generic.
Definition: MethodBase.cs:103
void ResolveMethod()
Sets method information from previously initialized remoting message properties.
Definition: MethodCall.cs:461
Represents a collection of key/value pairs that are organized based on the hash code of the key....
Definition: Hashtable.cs:17
Defines the out-of-band data for a call.
Definition: Header.cs:8
virtual IDictionary Properties
Gets an T:System.Collections.IDictionary interface that represents a collection of the remoting messa...
Definition: MethodCall.cs:199
MethodCall(Header[] h1)
Initializes a new instance of the T:System.Runtime.Remoting.Messaging.MethodCall class from an array ...
Definition: MethodCall.cs:260
MethodBase MethodBase
Gets the T:System.Reflection.MethodBase of the called method.
Definition: MethodCall.cs:157
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition: Array.cs:17
Represents type declarations: class types, interface types, array types, value types,...
Definition: Type.cs:18
Defines utility methods for use by the .NET Framework remoting infrastructure.
Provides information about methods and constructors.
Definition: MethodBase.cs:19
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...
Definition: MethodInfo.cs:109
virtual int Add(object value)
Adds an object to the end of the T:System.Collections.ArrayList.
Definition: ArrayList.cs:2381
Contains communication data sent between cooperating message sinks.
Definition: IMessage.cs:9
LogicalCallContext LogicalCallContext
Gets the T:System.Runtime.Remoting.Messaging.LogicalCallContext for the current method call.
Definition: MethodCall.cs:221
static CultureInfo CurrentCulture
Gets or sets the T:System.Globalization.CultureInfo object that represents the culture used by the cu...
Definition: CultureInfo.cs:120
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.
Definition: MethodCall.cs:352
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 ...
Definition: Array.cs:1275
Allows an object to control its own serialization and deserialization.
Definition: ISerializable.cs:8
object MethodSignature
Gets an object that contains the method signature.
Definition: MethodCall.cs:138
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...
Definition: MethodCall.cs:940
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)....
Definition: CultureInfo.cs:16
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...
Definition: Uri.cs:19
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....
Definition: MemberTypes.cs:9
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....
Provides static methods to aid with the implementation of a T:System.Runtime.Serialization....
Represents a nongeneric collection of key/value pairs.
Definition: IDictionary.cs:8
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.
Definition: MethodCall.cs:101
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...
Definition: ArrayList.cs:14
bool MoveNext()
Updates the enumerator to the next item.