473,382 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

System.AccessViolationException

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

---

An unhandled exception of type 'System.AccessViolationException'
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!

Oct 25 '06 #1
2 11247
"James Arnold" <ja****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
>I am getting the following error message in my WinForms project:

---

An unhandled exception of type 'System.AccessViolationException'
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.EndEdit perhaps

/claes
Oct 26 '06 #2
Source:
SourceLibrary.My.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.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TreeView.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)

Claes Bergefall wrote:
"James Arnold" <ja****@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
I am getting the following error message in my WinForms project:

---

An unhandled exception of type 'System.AccessViolationException'
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.EndEdit perhaps

/claes
Nov 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Richard Lionheart | last post by:
Hi All, I tried using RegEx, but the compiler barfed with "The type of namespace 'RegEx' could not be found. Prior to this, I had the same problem with MatchCollection, but discovered it's...
0
by: oarrocha | last post by:
I'm trying to use a DLL that was built with Visual C++.NET 7.1 on a new program that I'm developing in VS2005 C# program. Every time I call a function of the 7.1 DLL I receive an anoying...
5
by: deepakkumarb | last post by:
I am getting this exception while executing non query from .NET code to oracle 10g DB. Can you plz help System.AccessViolationException: Attempted to read or write protected memory. This is...
1
by: 4Codehelp | last post by:
I have a code in VC++ that gives this particular error on exiting the program while executing in release mode. Error: An unhandled exception of type 'System.AccessViolationException' occurred in...
1
by: Creativ | last post by:
A COM component has an method, called Register(Variant variant), which expect an array of string via Variant. If I want to use it, I can pass an object whose element boxes a string. The...
8
by: SSix2 | last post by:
.Net 2005 Managed C++ Background. I am writing a managed c++ wrapper for legacy unmanaged code. I created a test application in C# to create the legacywrapper and I am attempting to get some value...
12
by: rmiller407 | last post by:
I am getting an AccessViolationException when calling an old legacy fortran dll from c# in vs2008 express, but the same code worked fine in vs2005. If I create a vs2005 c# wrapper dll to call...
0
by: Dilip | last post by:
I have cross-posted this question to 3 newsgroups since I am not sure exactly where it belongs (and some NG's have very less activity). Apologies in advance for this. I have set the followup to...
2
by: =?Utf-8?B?VHJpc3RhbiBNU0ROIEtlZW4=?= | last post by:
I've written a test harness in C# to test one of our company's products, which is written in C. If the application crashes, the Instruction Address, Memory Address and the Access Type are stored...
5
by: craig1231 | last post by:
I have a problem trying to pass a structure to an unmanaged c++ DLL from C#. When I call PCSBSpecifyPilotLogon from C#, it throws an AccessViolationException This is what I have... The...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.