试图读取或写入受保护的内存 [英] Attempted to read or write protected memory

查看:434
本文介绍了试图读取或写入受保护的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始看到一个AccessViolationException被扔在我的应用程序中的几个不同点。它永远不会发生在我的开发PC,我们的测试服务器。它也只体现了自己对1我们的2生产服务器。因为它似乎只发生在我们的生产服务器中的一个,我开始寻找在服务器上安装了.NET Framework的版本。


我发现,(一些奇怪的原因),这是有问题的生产服务器有2.0 SP2,3.0 SP2和3.5 SP1,而其他生产服务器和测试服务器有2.0 SP1。


我的应用程序只针对2.0框架,决定卸载从生产服务器的所有框架版本并安装仅2.0 SP1。到目前为止,我一直无法重现该问题。非常有趣。

发展邮编:紧凑型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

现在,我为什么不能重现该问题在我的开发PC里面有2.0 SP2就可以了,我想不通。我听到传言说,此访问冲突可能发生在一些软件,利用远程处理,其中我的根本,但访问冲突从未happends当远程实际上是存在的。我确定只使用2.0 SP1的现在,但我真的很想知道,如果任何人有这个问题,如果他们找到了一个解决方法较新版本的frameowork的。

下面是几个例外情况和他们的堆栈跟踪:

  System.AccessViolationException:尝试读取或写入受保护的内存。这通常表明其他内存已损坏。
   在ICSharp code.TextEditor.TextArea.HandleKey preSS(字符CH)
   在ICSharp code.TextEditor.TextArea.SimulateKey preSS(字符CH)
   在ICSharp code.TextEditor.TextArea.OnKey preSS(主要pressEventArgs E)
   在System.Windows.Forms.Control.ProcessKeyEventArgs(消息&安培;米)
   在System.Windows.Forms.Control.ProcessKeyMessage(消息&安培;米)
   在System.Windows.Forms.Control.WmKeyChar(消息&安培;米)
   在System.Windows.Forms.Control.WndProc(消息&安培;米)
   在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息&安培;米)
   在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息&安培;米)
   在System.Windows.Forms.NativeWindow.Callback(IntPtr的的HWND,味精的Int32,IntPtr的WPARAM,IntPtr的LPARAM)

System.AccessViolationException:尝试读取或写入受保护的内存。这通常表明其他内存已损坏。
   在System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr的WNDPROC,IntPtr的的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的)
   在System.Windows.Forms.NativeWindow.DefWndProc(消息&安培;米)
   在System.Windows.Forms.Control.DefWndProc(消息&安培;米)
   在System.Windows.Forms.Control.WndProc(消息&安培;米)
   在System.Windows.Forms.TextBoxBase.WndProc(消息&安培;米)
   在System.Windows.Forms.RichTextBox.WndProc(消息&安培;米)
   在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息&安培;米)
   在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息&安培;米)
   在System.Windows.Forms.NativeWindow.Callback(IntPtr的的HWND,味精的Int32,IntPtr的WPARAM,IntPtr的LPARAM)
 

解决方案

我有同样的问题。 2.0工作的罚款。最多可安装3.5 SP1后,应用程序获取访问冲突。

安装 http://support.microsoft.com/kb/971030 ,我的问题就解决了​​,即使我我不使用的LCG。

I've started seeing an AccessViolationException being thrown in my application a several different spots. It never occured on my development pc, our test server. It also only manifested itself on 1 of our 2 production servers. Because it only seemed to happen on one of our production servers, I started looking at the installed .net framework versions on the servers.


I found that (for some strange reason), the production server that was having problems had 2.0 sp2, 3.0 sp2, and 3.5 sp1, while the other production server and the test server had 2.0 sp1.


My app only targets the 2.0 framework, decided to uninstall all the framework versions from the production server and install only 2.0 sp1. So far I have not been able to reproduce the problem. Very interesting.

Development pc: compact 2.0 sp2, compact 3.5, 2.0 sp2, 3.0 sp2, 3.5 sp1 Test server: 2.0 sp1 Production server1: 2.0 sp1 Production server2: 2.0 sp2, 3.0 sp2, 3.5 sp1

Now, why I can't reproduce the problem on my development pc which has 2.0 sp2 on it, I can't figure out. I heard rumors that this access violation may happen on some software that utilizes remoting, which mine does, but the access violation never happends when remoting is actually occuring. I'm ok with using only 2.0 sp1 for now, but I'm really interested to know if anyone has had this issue, and if they found a workaround for newer versions of the frameowork.

Here's a couple of the exceptions and their stack traces:

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)

解决方案

I had the same problem. 2.0 worked fine. after installing up to 3.5 sp1, application gets Access Violation.

installed http://support.microsoft.com/kb/971030 and my problem is solved, even though I am not using LCG.

这篇关于试图读取或写入受保护的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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