From 0bf74e519667c318d45ef85b8eb25c728c25eb41 Mon Sep 17 00:00:00 2001 From: de4dot Date: Sun, 11 Dec 2011 11:54:02 +0100 Subject: [PATCH] Don't cast the arg to its correct type --- AssemblyData/methodsrewriter/MethodsRewriter.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/AssemblyData/methodsrewriter/MethodsRewriter.cs b/AssemblyData/methodsrewriter/MethodsRewriter.cs index 967ffebf..687aa00d 100644 --- a/AssemblyData/methodsrewriter/MethodsRewriter.cs +++ b/AssemblyData/methodsrewriter/MethodsRewriter.cs @@ -296,8 +296,13 @@ namespace AssemblyData.methodsrewriter { var argType = mparams[j]; if (argType.IsValueType) block.insert(n++, Instruction.Create(OpCodes.Unbox_Any, argType)); - else - block.insert(n++, Instruction.Create(OpCodes.Castclass, argType)); + else { + // Don't cast it to its correct type. This will sometimes cause + // an exception in some EF obfuscated assembly since we'll be + // trying to cast a System.Reflection.AssemblyName type to some + // other type. + // block.insert(n++, Instruction.Create(OpCodes.Castclass, argType)); + } } }