Browse Source

#2092: Make TransformExpressionTrees.MatchGetTypeFromHandle and TransformExpressionTrees.MatchGetContructorFromHandle use IType.FullName instead of actual IType instances, so we can better handle assemblies processed by tools like ILMerge, where there might be used multiple versions of mscorlib in one assembly.

pull/2447/head
Siegfried Pammer 4 years ago
parent
commit
164c8880af
  1. 4
      ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs

4
ICSharpCode.Decompiler/IL/Transforms/TransformExpressionTrees.cs

@ -1426,7 +1426,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
//castclass System.Reflection.MethodInfo(call GetMethodFromHandle(ldmembertoken op_Addition)) //castclass System.Reflection.MethodInfo(call GetMethodFromHandle(ldmembertoken op_Addition))
if (!inst.MatchCastClass(out var arg, out var type)) if (!inst.MatchCastClass(out var arg, out var type))
return false; return false;
if (!type.Equals(context.TypeSystem.FindType(new FullTypeName("System.Reflection.MethodInfo")))) if (type.FullName != "System.Reflection.MethodInfo")
return false; return false;
if (!(arg is CallInstruction call && call.Method.FullName == "System.Reflection.MethodBase.GetMethodFromHandle")) if (!(arg is CallInstruction call && call.Method.FullName == "System.Reflection.MethodBase.GetMethodFromHandle"))
return false; return false;
@ -1439,7 +1439,7 @@ namespace ICSharpCode.Decompiler.IL.Transforms
//castclass System.Reflection.ConstructorInfo(call GetMethodFromHandle(ldmembertoken op_Addition)) //castclass System.Reflection.ConstructorInfo(call GetMethodFromHandle(ldmembertoken op_Addition))
if (!inst.MatchCastClass(out var arg, out var type)) if (!inst.MatchCastClass(out var arg, out var type))
return false; return false;
if (!type.Equals(context.TypeSystem.FindType(new FullTypeName("System.Reflection.ConstructorInfo")))) if (type.FullName != "System.Reflection.ConstructorInfo")
return false; return false;
if (!(arg is CallInstruction call && call.Method.FullName == "System.Reflection.MethodBase.GetMethodFromHandle")) if (!(arg is CallInstruction call && call.Method.FullName == "System.Reflection.MethodBase.GetMethodFromHandle"))
return false; return false;

Loading…
Cancel
Save