该应用程序是基于 .NET Framework 4.5 的 WPF 应用程序。它以 x86 模式构建,并在 Windows 7(32 位)上运行。
通过单击主窗口的关闭按钮退出应用程序时,有时会崩溃。
这是从转储文件中分析的主要信息。
在 XXX.exe.824.dmp 中,来自 Microsoft Corporation 的 C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 中 clr!RCW::EnterContext+18 处的汇编指令导致访问冲突异常 (0xC0000005 ) 在线程 2 上尝试写入内存位置 0x00000008 时
这是转储文件中的调用堆栈信息。
Source Arg 1 Arg2 Arg3 Arg4
clr!RCW::EnterContext+18 7e6ec72 3d9ab88 c4e7d31 381f8ac
clr!RCW::ReleaseAllInterfacesCallBack+41 5745bc0 c4e7d21 381f8ac 17aee40
clr!RCW::Cleanup+41 3d9ab88 7e6e944 0000000 381f8f0
clr!RCWCleanupList::ReleaseRCWListRaw+d 0000000 381f8f0 0000000 381f8cc
clr!RCWCleanupList::ReleaseRCWListInCorrectCtx+d1 0305028 c4e7d91 035a148 0000209
clr!RCWCleanupList::CleanupAllWrappers+14d c4e78a9 0000000 02aa860 0000001
clr!RCWCache::ReleaseWrappersWorker+22d 0000000 c4e78d9 0000000 5e9bccc
clr!ReleaseRCWsInCaches+59 c4e7b01 0000000 5e9bccc 02a0460
clr!InnerCoEEShutDownCOM+76 c4e7bd5 7eb1f23 0000000 02a0460
clr!WKS::GCHeap::FinalizerThreadStart+38a 0000000 0000000 0000000 0000000
clr!Thread::intermediateThreadProc+4d 02a0460 381ffb0 73537f5 02a0460
kernel32!BaseThreadInitThunk+e 02a0460 ba58f32 0000000 0000000
ntdll!__RtlUserThreadStart+70 7f2a8c0 02a0460 0000000 0000000
ntdll!_RtlUserThreadStart+1b 7f2a8c0 02a0460 0000000 0000000
这是来自 WinDbg 的另一个:
[0x0] ntdll!KiFastSystemCallRet
[0x1] ntdll!NtWaitForMultipleObjects + 0xc
[0x2] KERNELBASE!WaitForMultipleObjectsEx + 0x100
[0x3] kernel32!WaitForMultipleObjectsExImplementation + 0xe0
[0x4] kernel32!WaitForMultipleObjects + 0x18
[0x5] kernel32!WerpReportFaultInternal + 0x186
[0x6] kernel32!WerpReportFault + 0x70
[0x7] kernel32!BasepReportFault + 0x20
[0x8] kernel32!UnhandledExceptionFilter + 0x1af
[0x9] ntdll!__RtlUserThreadStart + 0x62
[0xa] ntdll!_EH4_CallFilterFunc + 0x12
[0xb] ntdll!_except_handler4 + 0x8e
[0xc] ntdll!ExecuteHandler2 + 0x26
[0xd] ntdll!ExecuteHandler + 0x24
[0xe] ntdll!RtlDispatchException + 0x127
[0xf] ntdll!KiUserExceptionDispatcher + 0xf
[0x10] clr!RCW::EnterContext + 0x18
[0x11] clr!RCW::ReleaseAllInterfacesCallBack + 0x41
[0x12] clr!RCW::Cleanup + 0x41
[0x13] clr!RCWCleanupList::ReleaseRCWListRaw + 0xd
[0x14] clr!RCWCleanupList::ReleaseRCWListInCorrectCtx + 0xd1
[0x15] clr!RCWCleanupList::CleanupAllWrappers + 0x14d
[0x16] clr!RCWCache::ReleaseWrappersWorker + 0x22d
[0x17] clr!ReleaseRCWsInCaches + 0x59
[0x18] clr!InnerCoEEShutDownCOM + 0x76
[0x19] clr!WKS::GCHeap::FinalizerThreadStart + 0x38a
[0x1a] clr!Thread::intermediateThreadProc + 0x4d
[0x1b] kernel32!BaseThreadInitThunk + 0xe
[0x1c] ntdll!__RtlUserThreadStart + 0x70
[0x1d] ntdll!_RtlUserThreadStart + 0x1b
我已经尝试在应用程序配置文件(xxx.exe.config)中添加以下配置,但它们都没有生效。
<configuration>
<runtime>
<legacyCorruptedStateExceptionsPolicy enabled="true" />
<gcConcurrent enabled="false" />
</runtime>
</configurtion>
那么如何处理或避免崩溃呢?