0

我在 UltraToolbarsManager (Infragistics) 的功能区中的某处遇到未处理的异常。但这不是我想在这里问的相关部分。我的问题是:为什么我在堆栈跟踪中看不到我的应用程序的任何方法?堆栈跟踪仅显示 Infragistics 和 Windows 窗体模块。

重现场景非常少见,但见过的几次总是在机器将要挂起模式时。异常由 Application.ThreadException 事件处理程序处理,我没有机会从不同的位置捕获(表单已加载并使用 Applicatioin.Run() 运行)。

以下是异常详细信息:

The handle is invalid
System.ComponentModel.Win32Exception
Stack Trace:
   bei System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
        bei System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize)
        bei System.Drawing.Graphics.CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
        bei Infragistics.Win.ControlUIElementBase.CaptureOldImage(UIElement element)
        bei Infragistics.Win.TransitionInfo..ctor(UIElement element, Transition transition, TransitionSettings settings)
        bei Infragistics.Win.ControlUIElementBase.InitiateTransition(TransitionSettings settings, Transition transition, UIElement element)
        bei Infragistics.Win.UIElement.InitiateTransition(TransitionSettings settings, UIElementTransitionType transitionType)
        bei Infragistics.Win.UltraWinToolbars.RibbonGroupUIElement.OnMouseLeave()
        bei Infragistics.Win.ControlUIElementBase.ElementEntered(UIElement element, Boolean triggerMouseLeavesOnly)
        bei Infragistics.Win.ControlUIElementBase.SyncMouseEntered(Boolean triggerMouseLeavesOnly, UIElementInputType inputType, Boolean ignoreLastElementEntered)
        bei Infragistics.Win.ControlUIElementBase.ProcessMouseLeave(Object sender, EventArgs e)
        bei Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
        bei Infragistics.Win.UltraControlBase.OnMouseLeave(EventArgs e)
        bei Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea.OnMouseLeave(EventArgs e)
        bei System.Windows.Forms.Control.WmMouseLeave(Message& m)
        bei System.Windows.Forms.Control.WndProc(Message& m)
        bei System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
        bei System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
        bei System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

除了从 Application.ThreadException 事件之外,还有其他方法可以捕获异常,我可以在其中看到更多详细信息?

该异常是在创建表单时在同一个线程上处理的,所以我认为它不是由另一个线程修改 UI 引起的。

我将不胜感激任何帮助或提示。

此致,

迈克尔

4

2 回答 2

0

Infragistics 论坛上也有关于相同行为的讨论。可以在这里找到:http: //www.infragistics.com/community/forums/p/79895/403562.aspx

谢谢。

于 2013-05-15T09:29:57.463 回答
0

答案可以在这里找到: http ://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/d55d7789-0454-461c-bb3a-62639c394603/

在 Windows 8 上,锁定屏幕出现在锁定屏幕前面,并且在 System.Drawing.Graphics.CopyFromScreen() 可以完成工作之前,句柄变得无效。

感谢您的聆听,感谢史蒂夫让我回到最初的想法:)

于 2013-05-13T06:33:18.423 回答