アプリケーションのいくつかの異なる場所で AccessViolationException がスローされるのを見始めました。テストサーバーである私の開発用PCでは発生しませんでした。また、2 つの実稼働サーバーのうちの 1 つにしか現れませんでした。実稼働サーバーの 1 つでのみ発生しているように見えたので、サーバーにインストールされている .net フレームワークのバージョンを調べ始めました。
(何らかの奇妙な理由で) 問題が発生した運用サーバーには 2.0 sp2、3.0 sp2、および 3.5 sp1 があり、他の運用サーバーとテスト サーバーには 2.0 sp1 があることがわかりました。
私のアプリは 2.0 フレームワークのみを対象としており、運用サーバーからすべてのフレームワーク バージョンをアンインストールし、2.0 sp1 のみをインストールすることにしました。これまでのところ、問題を再現できませんでした。とても興味深い。
開発用 PC: コンパクト 2.0 sp2、コンパクト 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 を搭載した私の開発用 PC には、わかりません。このアクセス違反は、リモーティングを使用する一部のソフトウェアで発生する可能性があるという噂を聞きましたが、実際にリモーティングが発生している場合はアクセス違反は発生しません。今のところ 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)