我需要在IL级调试一个dll,然后阅读http://blogs.msdn.com/b/jmstall/archive/2004/10/03/237137.aspx我想用il(d)asm反汇编/重新组装DLL。
反汇编贯穿,但重组失败并带有
Assembled method Dapper.SqlMapper°UdtTypeHandler::Dapper.SqlMapper.ITypeHandler.SetValue
Assembled method Dapper.SqlMapper°TypeHandler`1::Dapper.SqlMapper.ITypeHandler.SetValue
Assembled method Dapper.SqlMapper°TypeHandler`1::Dapper.SqlMapper.ITypeHandler.Parse
Assembled method Dapper.SqlMapper°TypeHandler`1::.ctor
Assembled method Dapper.SqlMapper°Link`2::TryGet
W:\TimPrecast\ildasm\ppdbcore.il(71204) : error : Undeclared identifier IL_0016
W:\TimPrecast\ildasm\ppdbcore.il(71204) : error : syntax error at token ':' in: IL_0016: ldloc.s
***** FAILURE *****
然后我在ILSpy中打开DLL并在记事本中打开生成的IL文件:
ILSpy:
IL_000a: stloc.1
IL_000b: ldloc.1
IL_000c: ldarg.1
IL_000d: ldloca.s found
IL_000f: call bool class Dapper.SqlMapper/Link`2<!TKey, !TValue>::TryGet(class Dapper.SqlMapper/Link`2<!0, !1>, !0, !1&)
IL_0014: stloc.s 4
IL_0016: ldloc.s 4
IL_0018: brfalse.s IL_0027
IL_001a: nop
IL_001b: ldarg.2
IL_001c: ldloc.2
IL_001d: stobj !TValue
IL_0022: ldc.i4.0
IL_0023: stloc.s 5
IL_0025: br.s IL_0051
ILDASM(第71204行是IL_0016):
IL_000a: stloc.1
IL_000b: ldloc.1
IL_000c: ldarg.1
IL_000d: ldloca.s found
IL_000f: call bool class Dapper.SqlMapper/Link`2<!TKey,!TValue>::TryGet(class Dapper.SqlMapper/Link`2<!0,!1>,
!0,
!1&)
IL_0014: stloc.s
IL_0016: ldloc.s
IL_0018: brfalse.s IL_0027
IL_001a: nop
IL_001b: ldarg.2
IL_001c: ldloc.2
IL_001d: stobj !TValue
IL_0022: ldc.i4.0
IL_0023: stloc.s V_5
IL_0025: br.s IL_0051
看起来缺少stloc.s的索引。
ILDasm帮助 - &gt;信息显示版本4.0.30319.0。