工具提示上的 AccessViolationException 导致 COMCTL32.dll 出错 - .NET 4.0 [英] AccessViolationException on ToolTip that faults COMCTL32.dll - .NET 4.0

查看:27
本文介绍了工具提示上的 AccessViolationException 导致 COMCTL32.dll 出错 - .NET 4.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的 Windows 窗体应用程序存在问题,由于堆栈跟踪指示发生在 ToolTip 控件中的 AccessViolationException 类型的未处理异常而终止.

We are having an issue with our Windows forms application where it is terminating due to an unhandled exception of type AccessViolationException that the stack trace is indicating occurs within the ToolTip control.

该错误发生在应用程序的不同时间,我们目前无法可靠地重现它.在这个阶段,它只发生在 Windows 7 的生产环境中,并且只针对某些用户,而不是其他用户——即使在以类似方式使用该应用程序的用户中也是如此.它似乎与机器相关,因此我们已经完成了诸如确保图形驱动程序是最新的操作.

The error occurs at different times in the application, and we are currently not able to reliably reproduce it. At this stage it is occurring only in production on Windows 7 and only for some users, but not others – even amongst users that use the application in a similar way. It appears to be machine related and so we have done things like ensure the graphics driver is up to date.

在事件日志中,总是记录 2 个不同的错误,一个与我们的应用程序有关:

In the event log, there are always 2 different errors logged, one relating to our application:

Application: <Application>.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.NativeWindow.DefWndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ToolTip.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ToolTip+ToolTipNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
   at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   at <Company>.Windows.Forms.<Application>.Startup.Main(System.String[])

还有一个与 comctl32.dll 相关的:

And one relating to comctl32.dll:

Faulting application name: <Application>.exe, version: 7.13.0.2086, time stamp: 0x4ec5e710
Faulting module name: comctl32.dll, version: 5.82.7601.17514, time stamp: 0x4ce7b82c
Exception code: 0xc0000005
Fault offset: 0x00043286
Faulting process id: 0xcdc
Faulting application start time: 0x01cca96312446309
Faulting application path: C:Program Files<Company>Client<Application>.exe
Faulting module path: C:WindowsWinSxSx86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.17514_none_ec83dffa859149afcomctl32.dll
Report Id: b425143c-1575-11e1-bccf-6c626d955bf1

第一个堆栈跟踪会根据工作流中错误发生的位置而变化,但是堆栈上的前 9 个项目始终相同,不同之处通常是出现在 Main() 方法和RunMessageLoop 方法.例如:

The first stack trace changes depending on where in the workflow the error occurs, however, the top 9 items on the stack are always the same, the difference is usually a showDialog call that appears in between the Main() method and the RunMessageLoop method. E.g.:

Application: <Application>.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.AccessViolationException
Stack:
   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr, IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.NativeWindow.DefWndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ToolTip.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ToolTip+ToolTipNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
   at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)
   at System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)
   at System.Windows.Forms.Form.ShowDialog()
   at <Company>.Windows.Forms.<Application>.ApplicationForm.<EventSubscribingMethod>(System.Object, System.EventArgs)
   at <Company>.<Application>.<Class1>.RaiseShowResultDialogNowEvent()
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(System.Object)
   at System.Threading.ExecutionContext.runTryCode(System.Object)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
   at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Form.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.OnMessage(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.Control+ControlNativeWindow.WndProc(System.Windows.Forms.Message ByRef)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG ByRef)
   at System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr, Int32, Int32)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)
   at System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)
   at <Company>.Windows.Forms.<Application>.Portal.Startup.Main(System.String[])

---- 更新----

---- Update ----

我收到了包含 Main 中的一些代码的请求,我不想包含所有代码,但摘录如下:

I have had a request to include some of the code from Main, I don't want to include all code, but an extract is:

 <System.STAThread()> _
    Public Shared Function Main(ByVal args() As String) As Integer
        -- Perform startup validation, setup logging framework, etc
        ...
        Dim appLife as new ApplicationContext(myStartupForm)
        Application.Run(appLife)
        Return 0

    End Function

一些补充说明:

有人知道是什么原因造成的吗?

Does anyone know what could be causing this?

谢谢,

推荐答案

根据 MS 的说法,在某些情况下 DataGrid 控件存在一个已知问题,避免此问题的方法是禁用 DataGrid 控件的工具提示.

According to MS, there is a known issue with the DataGrid control in certain situations, and the way to avoid this issue is to disable Tooltips for your DataGrid controls.

我们将在接下来的几天内实施更改并将其推广到一个试点小组,我将在大约一周后回复成功/失败(当然,除非在那之前发生失败).

We will be implementing the change and rolling it out to a pilot group in the next couple of days, I'll post back with success/failure in about a week (unless of course failure happens before then).

根据MS要设置的属性是DataGridView.ShowCellToolTips = false;

The property to set according to MS is DataGridView.ShowCellToolTips = false;

这解决了我们的应用程序的问题.

This fixed the issue for our application.

要重现该问题,我们需要执行以下操作:

To reproduce the issue, we needed to do the following:

  • 将鼠标悬停在我们知道会显示工具提示的 DataGridView 中的单元格上
  • 在显示工具提示之前切换到另一个应用程序(将显示在您的应用程序顶部)的 Alt 选项卡
  • 不要移动鼠标
  • Alt tab 返回我们的应用程序
  • 我们的应用程序崩溃了.

这篇关于工具提示上的 AccessViolationException 导致 COMCTL32.dll 出错 - .NET 4.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆