WER报告的神秘IL偏移

本文关键字:IL 偏移 报告 WER | 更新日期: 2023-09-27 18:28:24

我正在尝试解析Windows错误报告报告(report.wer)。

以下是报告的一部分:

Version=1
EventType=CLR20r3
... snip ...
Sig[0].Name=問題の署名 01
Sig[0].Value=myapp.exe
Sig[1].Name=問題の署名 02
Sig[1].Value=2.2.0.1
Sig[2].Name=問題の署名 03
Sig[2].Value=541bc264
Sig[3].Name=問題の署名 04
Sig[3].Value=System
Sig[4].Name=問題の署名 05
Sig[4].Value=2.0.0.0
Sig[5].Name=問題の署名 06
Sig[5].Value=4a275e12
Sig[6].Name=問題の署名 07
Sig[6].Value=2919
Sig[7].Name=問題の署名 08
Sig[7].Value=ef
Sig[8].Name=問題の署名 09
Sig[8].Value=System.IO.IOException
... snip ...

(其中問題の署名表示Problem Signature。)

通过SO解密.NET clr20r3异常参数P1.P10,我发现:

  • 出现故障的程序集是2.0.0.0版本的System
  • 故障方法标记为06002919
  • 故障IL偏移量为ef

但问题在于IL偏移值ef

System的方法06002919没有IL_00ef

以下是方法06002919:的定义

  .method /*06002919*/ assembly hidebysig 
          instance bool  Poll(int32 microSeconds,
                              valuetype System.Net.Sockets.SelectMode/*0200059D*/ mode) cil managed
  {
    // コード サイズ       81 (0x51)
    .maxstack  4
    .locals /*11000641*/ init (class System.Net.Sockets.Socket/*020005A0*/ V_0,
             object[] V_1)
    IL_0000:  ldarg.0
    IL_0001:  ldfld      bool System.Net.Sockets.NetworkStream/*02000547*/::m_CleanedUp /* 040027EA */
    IL_0006:  brfalse.s  IL_0019
    IL_0008:  ldarg.0
    IL_0009:  call       instance class [mscorlib/*23000001*/]System.Type/*01000065*/ [mscorlib/*23000001*/]System.Object/*01000001*/::GetType() /* 0A00006C */
    IL_000e:  callvirt   instance string [mscorlib/*23000001*/]System.Type/*01000065*/::get_FullName() /* 0A000136 */
    IL_0013:  newobj     instance void [mscorlib/*23000001*/]System.ObjectDisposedException/*01000179*/::.ctor(string) /* 0A0006A9 */
    IL_0018:  throw
    IL_0019:  ldarg.0
    IL_001a:  ldfld      class System.Net.Sockets.Socket/*020005A0*/ System.Net.Sockets.NetworkStream/*02000547*/::m_StreamSocket /* 040027E5 */
    IL_001f:  stloc.0
    IL_0020:  ldloc.0
    IL_0021:  brtrue.s   IL_0048
    IL_0023:  ldstr      "net_io_readfailure" /* 70011B97 */
    IL_0028:  ldc.i4.1
    IL_0029:  newarr     [mscorlib/*23000001*/]System.Object/*01000001*/
    IL_002e:  stloc.1
    IL_002f:  ldloc.1
    IL_0030:  ldc.i4.0
    IL_0031:  ldstr      "net_io_connectionclosed" /* 70011BBD */
    IL_0036:  call       string System.SR/*02000009*/::GetString(string) /* 06000029 */
    IL_003b:  stelem.ref
    IL_003c:  ldloc.1
    IL_003d:  call       string System.SR/*02000009*/::GetString(string,
                                                                 object[]) /* 06000028 */
    IL_0042:  newobj     instance void [mscorlib/*23000001*/]System.IO.IOException/*01000161*/::.ctor(string) /* 0A0006FD */
    IL_0047:  throw
    IL_0048:  ldloc.0
    IL_0049:  ldarg.1
    IL_004a:  ldarg.2
    IL_004b:  callvirt   instance bool System.Net.Sockets.Socket/*020005A0*/::Poll(int32,
                                                                                   valuetype System.Net.Sockets.SelectMode/*0200059D*/) /* 06002CDB */
    IL_0050:  ret
  } // end of method NetworkStream::Poll

我是不是看错了什么?如何正确解读WER报告?


上述IL转储的源System.dll取自我的开发机器上的GAC(C:''Windows''assembly''GAC_MSIL''System''2.0.0.0__b77a5c561934e089),而不是目标机器。

WER报告的神秘IL偏移

问题很可能是由尝试解码WER日志的计算机上的System.dll与发生异常的计算机之间的差异引起的。从发生异常的计算机中获取System.dll并使用它。

例如,在我的计算机上,此令牌(06002919)导致Timer构造函数:)

.class /*0200054C*/ abstract auto ansi nested assembly beforefieldinit Timer
...
{
  ...
  .method /*06002919*/ assembly hidebysig specialname rtspecialname 
        instance void  .ctor(int32 durationMilliseconds) cil managed
  {
    ...
    IL_0018:  ret
  } // end of method Timer::.ctor
}