none
AccessViolationException - how to debug/diagnose RRS feed

  • Question

  • Hello,

     

    Hell broke loose and I get an AccessViolationException in my code. I realize this must be related to some programming fault, the thing is I'm not sure by what means to debug/diagnose it. The error is raised in part of the code that disposes of some objects..

     

    So, what are the best practices on traking down AccessViolationExceptions?? What are the tools required?

    Monday, February 11, 2008 10:16 AM

Answers

All replies

  • Might as well post the stack trace:

    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.ListView.WndProc(Message& m)
       at CustomListView.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)
    
    



     

     

    Monday, February 11, 2008 10:34 AM
  • This article can get you started: How Can I Debug an Access Violation?

    And How to use ADPlus to troubleshoot "hangs" and "crashes" talked about an advanced tool.
    Monday, February 11, 2008 2:32 PM
  • Thanks Feng Chen!

    In fact, I have used the Call Stack window intensively in debugging this issue, so the first link is kind of useful. The second link I did not use.

     

    The solution involved a rework on how we work with the Observer pattern - we included some additional cheks to avoid code reentrance in UI events through the Item event that is raised when an item is deleted.

    Tuesday, February 12, 2008 11:29 AM