0

我收到错误“外部组件已引发异常”。在我的 VB.net 项目中随机出现。我们正在使用 .net 框架 4,我们从 VB 6 升级到 VB.NET。我用Windbg进行了调试,这里是详细信息

!pe
PDB symbol for clr.dll not loaded
Exception object: 05f95e18
Exception type:   System.TypeInitializationException
Message:          The type initializer for 'globalmodule.FrmMsgBox' threw an exception.
InnerException:   System.Runtime.InteropServices.SEHException, Use !PrintException 05f95cec to see more.
StackTrace (generated):
    SP       IP       Function
    0312FC28 7A97BB08 System_ni!System.ComponentModel.Component.Finalize()+0x18

StackTraceString: <none>
HResult: 80131534
0:002> !PrintException 05f95cec
Exception object: 05f95cec
Exception type:   System.Runtime.InteropServices.SEHException
Message:          External component has thrown an exception.
InnerException:   <none>
StackTrace (generated):
    SP       IP       Function
    00000000 00000000 testrec.exe!Unknown+0x1

StackTraceString: <none>
HResult: 80004005

call stack

 # ChildEBP RetAddr  Args to Child              
WARNING: Stack unwind information not available. Following frames may be wrong.
00 0312f0a4 79253990 e0434352 00000001 00000005 kernel32!RaiseException+0x52
01 0312f134 793b6a83 05f95e18 00000000 00000000 clr!CoInitializeEE+0x5511e
02 0312f154 793b6aff 05f95e18 00000000 00000004 clr!GetAddrOfContractShutoffFlag+0xf367
03 0312f180 793b6b3d 00000000 00000004 059c5c10 clr!GetAddrOfContractShutoffFlag+0xf3e3
04 0312f1b0 793b6b50 05f95e18 00000000 00000004 clr!GetAddrOfContractShutoffFlag+0xf421
05 0312f1c4 79252be6 05f95e18 00000004 13aa4fff clr!GetAddrOfContractShutoffFlag+0xf434
06 0312fb1c 7918e1ce 13aa4f67 79162160 7917793c clr!CoInitializeEE+0x54374
07 0312fb84 79162111 04bcf78c 13aa4f0b 0312fe68 clr!CreateAssemblyNameObject+0xd57f
08 0312fc00 7a97bb08 0312fc50 0015fc20 00000000 clr!CoUninitializeEE+0x3f69
09 0312fc20 7a97bb08 00000020 00000000 00000000 System_ni+0x15bb08
0a 0312fc48 7917ec61 0312fc94 792559cc 0312fe68 System_ni+0x15bb08
0b 0312fca4 7917eb29 05f95b8c 7a97baf0 00000000 clr!LogHelp_TerminateOnAssert+0x7829
0c 0312fcd0 7917ebb8 05f95b8c 05f95b8c 00000000 clr!LogHelp_TerminateOnAssert+0x76f1
0d 0312fce8 7917edff 05f95b8c 13aa49db 0312fd58 clr!LogHelp_TerminateOnAssert+0x7780
0e 0312fd38 7917ed3b 0015fc20 00000409 0312fd67 clr!LogHelp_TerminateOnAssert+0x79c7
0f 0312fd68 791cd5a6 0015fc20 00000000 0015fc20 clr!LogHelp_TerminateOnAssert+0x7903
10 0312fd84 7928453a 00000001 0312fe68 0015fc20 clr!GetCLRFunction+0x6383
11 0312fd98 792845bc 0312feb0 13aa4aab 0312feb0 clr!GetPrivateContextsPerfCounters+0x18bd
12 0312fe48 79284677 0312feb0 13aa4a4b 00000000 clr!GetPrivateContextsPerfCounters+0x193f
13 0312fea8 792f7ae7 00000000 00148308 00000000 clr!GetPrivateContextsPerfCounters+0x19fa

我无法理解为内部异常生成的堆栈跟踪(IP 00000000 function=testrec.exe!Unknown+0x1)

我确实从 !dumpstack 生成的调用堆栈中注意到了这一行

0312f0b0 79253990 clr!CoInitializeEE+0x5511e, calling kernel32!RaiseException

在网上搜索后,我知道了 CoInitializeEE 函数确保公共语言运行时执行引擎加载到进程中,如果执行引擎无法加载,将返回 E_FAIL。如果 HRESULTE_FAIL 返回到 System.Runtime.InteropServices.SEHException,它会将其映射到 ExternalException。那正确吗?如果是,执行引擎加载失败的原因可能是什么?

我是从 !u 那里得到的

!u 7A97BB08 
preJIT generated code
System.ComponentModel.Component.Finalize()
Begin 7a97baf0, size 41
7a97baf0 55              push    ebp
7a97baf1 8bec            mov     ebp,esp
7a97baf3 57              push    edi
7a97baf4 56              push    esi
7a97baf5 53              push    ebx
7a97baf6 83ec14          sub     esp,14h
7a97baf9 33c0            xor     eax,eax
7a97bafb 8945e8          mov     dword ptr [ebp-18h],eax
7a97bafe 33d2            xor     edx,edx
7a97bb00 8b01            mov     eax,dword ptr [ecx]
7a97bb02 8b402c          mov     eax,dword ptr [eax+2Ch]
7a97bb05 ff5014          call    dword ptr [eax+14h]
**>>> 7a97bb08 c745e400000000  mov     dword ptr [ebp-1Ch],0**
7a97bb0f c745e8fc000000  mov     dword ptr [ebp-18h],0FCh
7a97bb16 6828bb977a      push    offset System_ni+0x15bb28 (7a97bb28)
7a97bb1b eb00            jmp     System_ni+0x15bb1d (7a97bb1d)
7a97bb1d 58              pop     eax
7a97bb1e ffe0            jmp     eax
7a97bb20 8d65f4          lea     esp,[ebp-0Ch]
7a97bb23 5b              pop     ebx
7a97bb24 5e              pop     esi
7a97bb25 5f              pop     edi
7a97bb26 5d              pop     ebp
7a97bb27 c3              ret
7a97bb28 c745e800000000  mov     dword ptr [ebp-18h],0
7a97bb2f ebef            jmp     System_ni+0x15bb20 (7a97bb20)

更新: 此问题仅出现在 XP PC 和某些 Windows 8 PC 中。

谢谢你

4

0 回答 0