Message 1 of 13
Corrupt Memory Error
Not applicable
03-05-2009
05:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I need help in trying to track down an elusive bug. I’ve written a fairly sophisticated c# routine that creates blocks based on data stored in a database. My users have discovered that they can run the routine once to successfully create the blocks in their drawings. But if they try to run the routine a second time on the same drawing before closing this drawing, an error appears when the routine is trying to commit the transaction. The error that comes up is “Attempted to read or write protected memory” and then AutoCAD will crash. If the user saves and closes the drawing before running the routine a second time, the error does not appear.
I’ve done some searching on this forum and the internet for the answer and have implemented some changes to my application to try to solve this issue. One of the first measures I did was to make sure that I’ve disposed all objects that I’ve accessed through the GetObject(OpenMode) method and not dispose any object opened by a transaction. Then I made sure that my code was not accessing the block table or the modelspace record more than once at the same time in my routine. The error still occurs as before.
I use selection sets occasionally in my application to retrieve existing blocks. Should I be disposing of any of the objects associated with the selection sets?
What other measures can I take to try to solve this issue?
Any help would be greatly appreciated.
Stephen
I’ve done some searching on this forum and the internet for the answer and have implemented some changes to my application to try to solve this issue. One of the first measures I did was to make sure that I’ve disposed all objects that I’ve accessed through the GetObject(OpenMode) method and not dispose any object opened by a transaction. Then I made sure that my code was not accessing the block table or the modelspace record more than once at the same time in my routine. The error still occurs as before.
I use selection sets occasionally in my application to retrieve existing blocks. Should I be disposing of any of the objects associated with the selection sets?
What other measures can I take to try to solve this issue?
Any help would be greatly appreciated.
Stephen