By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,781 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,781 IT Pros & Developers. It's quick & easy.

.NET 2.0 Read or Write Protected Memory Error

P: 17
I understand that this has come up quite a bit in the forums, and I've looked over a lot of questions and possible solutions and haven't found one that has worked for me yet. I was hoping someone else might have an idea. Here's the full error message: (I underlined what I thought was the most relevant)

"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Windows.Forms.SafeNativeMethods.SetWindowPo s(HandleRef hWnd, HandleRef hWndInsertAfter, Int32 x, Int32 y, Int32 cx, Int32 cy, Int32 flags)
at System.Windows.Forms.Control.BringToFront()

at StormDuty.frmMain.frmMain_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"

The code that this appears to be referring to is this:

Expand|Select|Wrap|Line Numbers
  1. this.BringToFront();
'this' is referring to a windows form called frmMain.

This happens on only one person's machine. It works fine on my machine and 4 others, which is why it's making it so hard to debug.

About my program, it's a C# .NET 2.0 project being developed in Visual Studio 2005. It uses One-Click deployment and connects to an Access database. In another forum, someone asked what Interops were being used. I'm using an interop with Outlook specifically and one with Office in general. I'm also using Crystal Reports.

I've tried reinstalling the .NET frameworks(1.1 and 2.0) on the person's computer several times with no effect.

Any help would be greatly appreciated and if you need any more information, feel free to ask.

Thank you,
Steve
Oct 18 '07 #1
Share this Question
Share on Google+
4 Replies


P: 8
Yeah, i too am having the same problem. We get this error randomly on certain machines, and it is usually when we are making a COM API call. Not on a .NET call.

We use a COM API for managing GIS map data. All i know is that this exception in new to the 2.0 and it seems that the framework is trying to decide when it is getting into a situation with COM interop (unmanaged code) that may be dangerous. So depends on the computer, memory available, etc...

I have not cracked it yet, but it is debilitating some of our apps and clients. If you find anything our PLEASE pass it on.

Thanks,
Pete
Oct 18 '07 #2

P: 17
I've been working on this problem off and on for a while now and we've resorted to completely reimaging the user's computer who gets this error. The error still occurs. Does anyone know anything about this? I'm really at a loss.

Thanks,
Steve
Jan 3 '08 #3

Frinavale
Expert Mod 5K+
P: 9,731
I've been working on this problem off and on for a while now and we've resorted to completely reimaging the user's computer who gets this error. The error still occurs. Does anyone know anything about this? I'm really at a loss.

Thanks,
Steve
I replied to your post but realized that it's probably not going to be any help...it's really my own question and debugging progress on the same sort of problem.

If you want to check it out...feel free. You can find it here.

-Frinny
Jan 3 '08 #4

P: 17
So I finally came up with a solution for this problem. It was the user's mouse driver. I don't know how, but somehow it was interfering with my application. That was surprising considering ClickOnce deployment is supposed to be isolated and self-sufficient. Anyway, hopefully this helps someone.
Jan 11 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.