Winform中嵌入WPF控件导致应用程序崩溃

发布于 2024-09-09 04:12:49 字数 2878 浏览 6 评论 0原文

我正在开发一个 Outlook 插件,我们使用 ElementHost 嵌入 Windows 表单中的 WPF 用户控件。

该应用程序仅在少数机器上间歇性崩溃。分析故障转储后,WPF 渲染线程似乎导致了此崩溃。windbg 中的堆栈跟踪看起来像

    FAULTING_IP: 
msvcr80!memcpy+5a
7814500a f3a5            rep movs dword ptr es:[edi],dword ptr [esi]

EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 7814500a (msvcr80!memcpy+0x0000005a)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000001
   Parameter[1]: ab386000
Attempt to write to address ab386000

FAULTING_THREAD:  00001024

PRIMARY_PROBLEM_CLASS:  STRING_DEREFERENCE

BUGCHECK_STR:  APPLICATION_FAULT_STRING_DEREFERENCE_INVALID_POINTER_WRITE

LAST_CONTROL_TRANSFER:  from 5404fa9b to 7814500a

STACK_TEXT:  
2206f834 5404fa9b ab386000 261b80c0 00000080 msvcr80!memcpy+0x5a
2206f8c8 540503ee 0102e810 00000006 00000002 wpfgfx_v0300!CD3DDeviceLevel1::DrawPrimitiveUP+0x313
2206f8cc 0102e810 00000006 00000002 261b80c0 wpfgfx_v0300!CD3DDeviceLevel1::FlushBufferFan+0x1f
WARNING: Frame IP not in any known module. Following frames may be wrong.
2206f914 5408788b 00000000 261b80c0 00000000 0x102e810
2206f990 540878ef 2602e810 00000016 2602eb90 wpfgfx_v0300!CD3DDeviceLevel1::TestRenderTargetFormat+0x21e
2206f9b0 54087bd0 00000016 2602eb90 2206fbb4 wpfgfx_v0300!CD3DDeviceLevel1::CheckRenderTargetFormat+0x5b
2206fad4 54086c70 541870d0 26047da8 00000000 wpfgfx_v0300!CD3DDeviceManager::CreateNewDevice+0x2c3
2206fbe0 5401f473 541870d0 26047da8 000804e2 wpfgfx_v0300!CD3DDeviceManager::GetD3DDeviceAndPresentParams+0x1c1
2206fc58 5401efd6 26047da8 000804e2 00000000 wpfgfx_v0300!CHwDisplayRenderTarget::Create+0x39
2206fd98 5401f1b6 26047da8 000804e2 00000000 wpfgfx_v0300!CDesktopRenderTarget::Init+0x210
2206fdbc 5401f290 26047da8 000804e2 00000000 wpfgfx_v0300!CDesktopRenderTarget::Create+0xfa
2206fdf8 5401f339 0020cc18 26047da8 000804e2 wpfgfx_v0300!CMILFactory::CreateDesktopRenderTarget+0xc5
2206fe30 5400becc 00000000 0b8c2858 00000000 wpfgfx_v0300!CSlaveHWndRenderTarget::EnsureRenderTargetInternal+0xef
2206febc 5400be78 2206fedb 0b8b62a4 2206ff6b wpfgfx_v0300!CSlaveHWndRenderTarget::Render+0x17
2206fedc 54007523 2206ff6b 0b8b6280 00000000 wpfgfx_v0300!CRenderTargetManager::Render+0x2e
2206fef4 540075d6 2206ff6b 0b8c2730 0b8b6288 wpfgfx_v0300!CComposition::Render+0x21
2206ff58 54007667 2206ff6b 0b8b6288 008b6288 wpfgfx_v0300!CComposition::ProcessComposition+0xf3
2206ff6c 540076a2 2206ff87 00000001 0b8c2730 wpfgfx_v0300!CComposition::Compose+0x3e
2206ff88 5400717b 0b8c2730 0b8c26d0 0b8b6288 wpfgfx_v0300!CPartitionThread::RenderPartition+0x1c
2206ff9c 5400b68e 79e820a6 0000000d 0b8c2730 wpfgfx_v0300!CPartitionThread::Run+0x48
2206ffb4 7c80b729 0b8c2730 79e820a6 0000000d wpfgfx_v0300!CPartitionThread::ThreadMain+0x1e
2206ffec 00000000 5400b670 0b8c2730 00000000 kernel32!BaseThreadStart+0x37

I am working on an outlook addin where we are using WPF user control embedded in a Windows form using ElementHost.

This app crashes on only few machines intermittently.After analyzing crash dump,the WPF rendering thread seems to be causing this crash.The stack trace in the windbg looks like

    FAULTING_IP: 
msvcr80!memcpy+5a
7814500a f3a5            rep movs dword ptr es:[edi],dword ptr [esi]

EXCEPTION_RECORD:  ffffffff -- (.exr 0xffffffffffffffff)
ExceptionAddress: 7814500a (msvcr80!memcpy+0x0000005a)
   ExceptionCode: c0000005 (Access violation)
  ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 00000001
   Parameter[1]: ab386000
Attempt to write to address ab386000

FAULTING_THREAD:  00001024

PRIMARY_PROBLEM_CLASS:  STRING_DEREFERENCE

BUGCHECK_STR:  APPLICATION_FAULT_STRING_DEREFERENCE_INVALID_POINTER_WRITE

LAST_CONTROL_TRANSFER:  from 5404fa9b to 7814500a

STACK_TEXT:  
2206f834 5404fa9b ab386000 261b80c0 00000080 msvcr80!memcpy+0x5a
2206f8c8 540503ee 0102e810 00000006 00000002 wpfgfx_v0300!CD3DDeviceLevel1::DrawPrimitiveUP+0x313
2206f8cc 0102e810 00000006 00000002 261b80c0 wpfgfx_v0300!CD3DDeviceLevel1::FlushBufferFan+0x1f
WARNING: Frame IP not in any known module. Following frames may be wrong.
2206f914 5408788b 00000000 261b80c0 00000000 0x102e810
2206f990 540878ef 2602e810 00000016 2602eb90 wpfgfx_v0300!CD3DDeviceLevel1::TestRenderTargetFormat+0x21e
2206f9b0 54087bd0 00000016 2602eb90 2206fbb4 wpfgfx_v0300!CD3DDeviceLevel1::CheckRenderTargetFormat+0x5b
2206fad4 54086c70 541870d0 26047da8 00000000 wpfgfx_v0300!CD3DDeviceManager::CreateNewDevice+0x2c3
2206fbe0 5401f473 541870d0 26047da8 000804e2 wpfgfx_v0300!CD3DDeviceManager::GetD3DDeviceAndPresentParams+0x1c1
2206fc58 5401efd6 26047da8 000804e2 00000000 wpfgfx_v0300!CHwDisplayRenderTarget::Create+0x39
2206fd98 5401f1b6 26047da8 000804e2 00000000 wpfgfx_v0300!CDesktopRenderTarget::Init+0x210
2206fdbc 5401f290 26047da8 000804e2 00000000 wpfgfx_v0300!CDesktopRenderTarget::Create+0xfa
2206fdf8 5401f339 0020cc18 26047da8 000804e2 wpfgfx_v0300!CMILFactory::CreateDesktopRenderTarget+0xc5
2206fe30 5400becc 00000000 0b8c2858 00000000 wpfgfx_v0300!CSlaveHWndRenderTarget::EnsureRenderTargetInternal+0xef
2206febc 5400be78 2206fedb 0b8b62a4 2206ff6b wpfgfx_v0300!CSlaveHWndRenderTarget::Render+0x17
2206fedc 54007523 2206ff6b 0b8b6280 00000000 wpfgfx_v0300!CRenderTargetManager::Render+0x2e
2206fef4 540075d6 2206ff6b 0b8c2730 0b8b6288 wpfgfx_v0300!CComposition::Render+0x21
2206ff58 54007667 2206ff6b 0b8b6288 008b6288 wpfgfx_v0300!CComposition::ProcessComposition+0xf3
2206ff6c 540076a2 2206ff87 00000001 0b8c2730 wpfgfx_v0300!CComposition::Compose+0x3e
2206ff88 5400717b 0b8c2730 0b8c26d0 0b8b6288 wpfgfx_v0300!CPartitionThread::RenderPartition+0x1c
2206ff9c 5400b68e 79e820a6 0000000d 0b8c2730 wpfgfx_v0300!CPartitionThread::Run+0x48
2206ffb4 7c80b729 0b8c2730 79e820a6 0000000d wpfgfx_v0300!CPartitionThread::ThreadMain+0x1e
2206ffec 00000000 5400b670 0b8c2730 00000000 kernel32!BaseThreadStart+0x37

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

江湖彼岸 2024-09-16 04:12:49

此问题是由于视频驱动程序问题造成的。安装最新(稳定)的视频驱动程序应该可以解决该问题。

解决此问题的另一种方法是禁用硬件渲染。

此线程中的更多详细信息
http://social. msdn.microsoft.com/Forums/en-US/wpf/thread/684b550f-80b4-4fe4-8cd2-b04f58dc50a5

This issue is due to a problem with the video driver. Installing latest(stable) video driver should sove the issue.

Another way to resolve this would be to disable hardware rendering.

More details in this thread
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/684b550f-80b4-4fe4-8cd2-b04f58dc50a5

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文