System.AccessViolationException running debugger

V

V&G

Hello all!

Sometimes, not consistently, focus change cause the WinForm
application, running in debug mode, to throw following exception:
==================================================
"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.ToolTip.WndProc(Message& msg)
at System.Windows.Forms.ToolTip.ToolTipNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at MqPlus.Gui.FrmMain.Main() in
C:\Projects\MqPlus\MqPlus\FrmMain.cs:line 352"
==================================================

The scenario is: run application (F5), switch to other application
(Alt+Tab), switch vice versa
to application.
There is no unsafe code in application. There is no COM/COM+/or other
not .NET libraries usage.

Do someone have idea what may cause such exception?

Thanks ahead
 
K

keremskusmezer

Can you provide more of the source code for review? For Example the
portion of the application.run???
Are you doing some multithreaded operation there???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top