gpt4 book ai didi

c# - Windows 窗体 ComboBox 导致间歇性 System.AccessViolationException

转载 作者:可可西里 更新时间:2023-11-01 08:50:04 24 4
gpt4 key购买 nike

一些背景故事:

我搜索了 stackoverflow 和 Google 以找出这个特定异常的来源。

我们有一个 Windows 窗体(C#、.NET 2.0)应用程序偶尔会抛出 System.AccessViolationException(下面的堆栈跟踪)。 Windows XP (SP3) 和 Windows Vista (SP2) 均出现异常。根据用户输入,我们确定当 ComboBox 的选定索引发生更改时会发生异常。

ComboBox 是一个标准的 Windows 窗体组件,它包含在继承 System.Windows.Forms.UserControl 的自定义控件中。

我的主要查询是:

这个异常从何而来?

  • 它是否来自 .NET 框架中的某些内部错误?
  • 会不会是在 SelectedIndexChanged 事件上分派(dispatch)的代码导致了它?

关于 stackoverflow 的相关主题:

堆栈跟踪:

Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Type: System.AccessViolationException

at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

最佳答案

我也有这些问题,早在我使用 .net 2.0 WinForms 的时候。我好像记得微软为此发布了一个 Hotfix。我用谷歌搜索了一下,找到了这两个。你可以试试看。

http://support.microsoft.com/kb/923028

http://support.microsoft.com/kb/971030

此外,您是否安装了 .NET 2.0 的所有服务包?

关于c# - Windows 窗体 ComboBox 导致间歇性 System.AccessViolationException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6185562/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com