1

我遇到了一个不起眼的 .NET (WPF) 崩溃。我的应用程序是使用 64 位平台目标编译的,它静默崩溃(没有对话框或任何东西),并且在我的用户计算机子集上的 Windows 事件查看器中记录了一个事件。

我的应用程序由主要的 WPF 可执行文件和一个类库 DLL 组成,它们都是为 .NET Framework 4 客户端配置文件编译的,并且都具有 64 位的目标平台。

奇怪的是,如果我使用 Any CPU 的目标平台编译 WPF 可执行文件,但将类库的目标设为 64 位,那么应用程序会突然启动正常。

堆栈跟踪如下所示:


(a30.f0): Access violation - code c0000005 (first/second chance not available)
ntdll!RtlPcToFileHeader+0x97:
00000000`7729ce6b 418b4350        mov     eax,dword ptr [r11+50h] ds:00000000`00000050=????????
0:000> k
  *** Stack trace for last set context - .thread/.cxr resets it
Child-SP          RetAddr           Call Site
00000000`004cefd0 000007fe`f1cecf00 ntdll!RtlPcToFileHeader+0x97
00000000`004cf050 000007fe`f1cece5d MSVCR110_CLR0400!__ExceptionPtr::_CopyException+0x8b
00000000`004cf140 000007fe`f1cec978 MSVCR110_CLR0400!__ExceptionPtr::_InitBadAllocException+0x5d
00000000`004cf1a0 000007fe`f1cf519b MSVCR110_CLR0400!IsProcessorFeaturePresent+0x1bfe
00000000`004cf1d0 000007fe`f1ced41f MSVCR110_CLR0400!initterm+0x1f
00000000`004cf200 000007fe`f1ced3bf MSVCR110_CLR0400!cinit+0x3f
00000000`004cf230 00000000`772cb0d8 MSVCR110_CLR0400!CrtEndBoot+0x65
00000000`004cf260 00000000`772b784a ntdll!LdrpRunInitializeRoutines+0x1fe
00000000`004cf430 00000000`772b7b2e ntdll!LdrpLoadDll+0x231
00000000`004cf640 000007fe`fd9b9aa9 ntdll!LdrLoadDll+0x9a
00000000`004cf6b0 000007fe`fc24b05b KERNELBASE!LoadLibraryExW+0x22e
00000000`004cf720 000007fe`fc24aee3 mscoreei!RuntimeDesc::LoadLibrary+0x193
00000000`004cf8a0 000007fe`fc242611 mscoreei!RuntimeDesc::LoadMainRuntimeModule+0x266
00000000`004cf940 000007fe`fc24b2fb mscoreei!RuntimeDesc::EnsureLoaded+0x6a
00000000`004cf9d0 000007fe`fc24b299 mscoreei!RuntimeDesc::GetProcAddressInternal+0x23
00000000`004cfa00 000007fe`fc248974 mscoreei!CLRRuntimeInfoImpl::GetProcAddress+0x61
00000000`004cfa80 000007fe`fc2474c8 mscoreei!GetCorExeMainEntrypoint+0x120
00000000`004cfb40 000007fe`fb685b21 mscoreei!CorExeMain+0x41
00000000`004cfb90 00000000`76bc652d mscoree!CorExeMain_Exported+0x57
00000000`004cfbc0 00000000`772bc521 kernel32!BaseThreadInitThunk+0xd
00000000`004cfbf0 00000000`00000000 ntdll!RtlUserThreadStart+0x1d

这对我来说显然是一个大问题,因为这意味着我不能保证我的应用程序实际上会在最终用户的计算机上运行。

有没有人遇到过类似的事情并知道如何解决?我的应用程序正在加载 64 位 DLL,我想绝对确定它没有在 32 位模式下运行。

4

0 回答 0