我开始看到我的应用程序中的几个不同位置抛出了 AccessViolationException。它从未发生在我的开发电脑、我们的测试服务器上。它也只出现在我们 2 台生产服务器中的 1 台上。因为它似乎只发生在我们的一台生产服务器上,所以我开始查看服务器上安装的 .net 框架版本。
我发现(由于某些奇怪的原因),出现问题的生产服务器有 2.0 sp2、3.0 sp2 和 3.5 sp1,而其他生产服务器和测试服务器有 2.0 sp1。
我的应用程序仅针对 2.0 框架,决定从生产服务器卸载所有框架版本并仅安装 2.0 sp1。到目前为止我还无法重现该问题。很有意思。
开发电脑:compact 2.0 sp2、compact 3.5、2.0 sp2、3.0 sp2、3.5 sp1
测试服务器:2.0 sp1
生产服务器1:2.0 sp1
生产服务器2:2.0 sp2、3.0 sp2、3.5 sp1
现在,为什么我无法在装有 2.0 sp2 的开发电脑上重现该问题,我不明白。我听说有传言说这种访问冲突可能会发生在某些使用远程处理的软件上,我的软件就是如此,但当远程处理实际发生时,访问冲突从未发生过。我现在可以只使用 2.0 sp1,但我真的很想知道是否有人遇到过这个问题,以及他们是否找到了新版本框架的解决方法。
以下是一些异常及其堆栈跟踪:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at ICSharpCode.TextEditor.TextArea.HandleKeyPress(Char ch)
at ICSharpCode.TextEditor.TextArea.SimulateKeyPress(Char ch)
at ICSharpCode.TextEditor.TextArea.OnKeyPress(KeyPressEventArgs e)
at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
at System.Windows.Forms.Control.WmKeyChar(Message& m)
at System.Windows.Forms.Control.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)
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
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.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.RichTextBox.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 4.5 升级到 .NET 4.5.1 后,我遇到了同样的问题。对我来说解决这个问题的是运行这个命令:
netsh winsock reset
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)