System.AccessViolationException

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James Arnold

    System.AccessViolationException

    I am getting the following error message in my WinForms project:

    ---

    An unhandled exception of type 'System.AccessV iolationExcepti on'
    occurred in System.Windows. Forms.dll

    Additional information: Attempted to read or write protected memory.
    This is often an indication that other memory is corrupt.

    ---

    I have narrowed the problem down to a TreeView - if the user is
    currently editing the label of a TreeNode (using node.BeginEdit) and I
    then add a new node to the TreeView, the exception gets thrown.

    However - I cannot seem to programatically end the editing of the
    TreeNode first (assuming that will stop the error). Can anyone direct
    me to a solution please?

    Thanks!

  • Claes Bergefall

    #2
    Re: System.AccessVi olationExceptio n

    "James Arnold" <jarnie@gmail.c omwrote in message
    news:1161795773 .732002.253280@ e3g2000cwe.goog legroups.com...
    >I am getting the following error message in my WinForms project:
    >
    ---
    >
    An unhandled exception of type 'System.AccessV iolationExcepti on'
    occurred in System.Windows. Forms.dll
    >
    Additional information: Attempted to read or write protected memory.
    This is often an indication that other memory is corrupt.
    >
    ---
    >
    Do you get any callstack or any other useful information?

    I have narrowed the problem down to a TreeView - if the user is
    currently editing the label of a TreeNode (using node.BeginEdit) and I
    then add a new node to the TreeView, the exception gets thrown.
    Where/how are you adding the new node?
    Can you reproduce the problem in a small program?

    However - I cannot seem to programatically end the editing of the
    TreeNode first (assuming that will stop the error). Can anyone direct
    me to a solution please?
    TreeNode.EndEdi t perhaps

    /claes


    Comment

    • James Arnold

      #3
      Re: System.AccessVi olationExceptio n

      Source:
      SourceLibrary.M y.MyApplication
      =IntPtr CallWindowProc( IntPtr, IntPtr, Int32, IntPtr, IntPtr)

      Message:
      Attempted to read or write protected memory. This is often an
      indication that other memory is corrupt.

      StackTrace:
      at System.Windows. Forms.UnsafeNat iveMethods.Call WindowProc(IntP tr
      wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
      at System.Windows. Forms.NativeWin dow.DefWndProc( Message& m)
      at System.Windows. Forms.Control.D efWndProc(Messa ge& m)
      at System.Windows. Forms.Control.W ndProc(Message& m)
      at System.Windows. Forms.TreeView. WndProc(Message & m)
      at
      System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
      at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
      m)
      at System.Windows. Forms.NativeWin dow.Callback(In tPtr hWnd, Int32
      msg, IntPtr wparam, IntPtr lparam)

      Claes Bergefall wrote:
      "James Arnold" <jarnie@gmail.c omwrote in message
      news:1161795773 .732002.253280@ e3g2000cwe.goog legroups.com...
      I am getting the following error message in my WinForms project:

      ---

      An unhandled exception of type 'System.AccessV iolationExcepti on'
      occurred in System.Windows. Forms.dll

      Additional information: Attempted to read or write protected memory.
      This is often an indication that other memory is corrupt.

      ---
      >
      Do you get any callstack or any other useful information?
      >
      >
      I have narrowed the problem down to a TreeView - if the user is
      currently editing the label of a TreeNode (using node.BeginEdit) and I
      then add a new node to the TreeView, the exception gets thrown.
      >
      Where/how are you adding the new node?
      Can you reproduce the problem in a small program?
      >
      >
      However - I cannot seem to programatically end the editing of the
      TreeNode first (assuming that will stop the error). Can anyone direct
      me to a solution please?
      >
      TreeNode.EndEdi t perhaps
      >
      /claes

      Comment

      Working...