Chr*_*fer 11 c# combobox exception-handling .net-2.0 winforms
一些背景故事:
我搜索了stackoverflow和Google来找出这个特殊异常的起源.
我们有一个Windows窗体(C#,. NET 2.0)应用程序偶尔会抛出一个System.AccessViolationException(下面的堆栈跟踪).Windows XP(SP3)和Windows Vista(SP2)都发生了异常.从用户输入,我们已经确定当更改ComboBox的选定索引时发生异常.
ComboBox是标准的Windows窗体组件,它包含在继承的自定义控件中System.Windows.Forms.UserControl.
我的主要问题是:
这个异常来自哪里?
SelectedIndexChanged导致它的事件调度的代码吗?有关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)
Run Code Online (Sandbox Code Playgroud)
早在我使用 .net 2.0 WinForms 时,我也遇到过这些问题。我似乎记得微软为此发布了一个修补程序。我用谷歌搜索并找到了这两个。你可以尝试一下。
http://support.microsoft.com/kb/923028
http://support.microsoft.com/kb/971030
另外,您是否安装了 .NET 2.0 的所有 Service Pack?
| 归档时间: |
|
| 查看次数: |
2390 次 |
| 最近记录: |