通用 GDI+ 堆栈跟踪中出现 ThreadExceptionDialog 错误

发布于 2024-07-17 14:27:51 字数 1435 浏览 4 评论 0原文

我们收到了一些难以重现的错误报告。 用户收到“发生错误。应用程序现在将退出”。 消息框,然后应用程序退出。

在 Main() 中,我将异常写入日志文件:

System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap, IntPtr hpalette)
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap)
at System.Drawing.Icon.ToBitmap()
at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
at System.Windows.Forms.Control.WndProcException(Exception e)
at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Wfm.AppMain.Main()

令我困惑的是 ThreadExceptionDialog 位于堆栈跟踪中。 我想该对话框显示“发生错误。应用程序现在将退出。” 信息。

这是一个不相关的错误还是对话框重新抛出异常? 我如何获得原始异常?

We received some hard to reproduce error reports. The users gets the "An error occurred. The application will now exit." message box and then the app exits.

In Main() I write the exception to a log file:

System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap, IntPtr hpalette)
at System.Drawing.Image.FromHbitmap(IntPtr hbitmap)
at System.Drawing.Icon.ToBitmap()
at System.Windows.Forms.ThreadExceptionDialog..ctor(Exception t)
at System.Windows.Forms.Application.ThreadContext.OnThreadException(Exception t)
at System.Windows.Forms.Control.WndProcException(Exception e)
at System.Windows.Forms.Control.ControlNativeWindow.OnThreadException(Exception e)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Wfm.AppMain.Main()

What confuses me is that the ThreadExceptionDialog is in the stack trace. I suppose that is the dialog that shows the "An error occurred. The application will now exit." message.

Is this an unrelated error or is the dialog rethrowing the exception? How can I get the original exception?

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

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

发布评论

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

评论(2

复古式 2024-07-24 14:27:51

看起来 OnThreadException 方法已被调用,这意味着您应该能够为 Application.ThreadException 事件,以便更详细地检查异常。

It looks like the OnThreadException method has been invoked, which means that you should be able to set up an event handler for the Application.ThreadException event, in order to examine the exception more in detail.

话少情深 2024-07-24 14:27:51

您需要一个转储文件,然后使用 SOS 获取堆栈上的所有异常对象。
BTW 那台机器上的资源情况如何? 看起来应用程序无法将图标转换为位图,这在极端的资源压力下可能会发生。

一旦看到异常窗口,您就可以在挂起模式下使用 ADPlus 创建转储。

You need a dump file, then use SOS to get all the exception objects that are on the stack.
BTW what the resource situation on that machine? it looks like the application could not convert a icon into bitmap which can happen under extreme resource pressure.

You can create a dump by using ADPlus in hang mode once you see the exception window.

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