Reputation: 19258
Starting recently, I now get AccessViolationException
s on most startups of our WinForms app from inside Visual Studio 2010, leading it to abort.
But doing a Ctrl-F5 instead of the usual F5 fixes the issue for me, i.e. it's kind of the opposite of AccessViolationException outside Visual Studio?.
Here's an example of such an exception, but they come with various other stack traces, too, not just this one:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Environment.get_TickCount()
at System.EventHandler.Invoke(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(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at OurApp.BaseForm.WndProc(Message& m)
at OurApp.OtherForm.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)
Btw. starting up again I just had this exact same stack trace, but with a
System.Runtime.InteropServices.SEHException: External component has thrown an exception.
instead of the AccessViolationException. But overall, the AccessViolationExceptions are way more frequent than SEHException
s.
Update Meanwhile, I sometimes get ExecutionEngineException
s instead of the above.
I'm running Windows 7 64bit (in a VirtualBox). Installing all Windows Updates, including Visual Studio 2010 SP1, just in case, did not fix the problem.
Any ideas on what this might be or how to dig deeper into it?
Upvotes: 0
Views: 1236
Reputation: 1340
My issue was also VirtualBox causing the issue. Couple things per Eugene Beresovksy's marked answer that references http://altamodatech.com/blogs/?p=62:
I have not had the problem since doing both things so I am sticking with VirtualBox for now.
For reference, my configuration:
Hope this helps.
Upvotes: 0
Reputation: 19258
It turned out to be an issue with VirtualBox. Running the app natively is fine, running the app in VMWare Player is fine, too. In VirtualBox: One of the 3 Exceptions listed in the question.
I could not get VirtualBox (latest version, 4.1.12, running on an i5 host under 64bit linux) to work properly, trying various settings as suggested on http://altamodatech.com/blogs/?p=62 . So VMWare Player it is, for now.
Upvotes: 1