.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

'System.AccessViolationException'

1 REPLY 1
SOLVED
Reply
Message 1 of 2
adadnet
2899 Views, 1 Reply

'System.AccessViolationException'

hi

 

A first chance exception of type 'System.AccessViolationException' occurred in Unknown Module.

 

the above message appears in vs2010's immediate window upon starting debuging vb.net code and it opening autocad2011, i.e. prior to actually executing the code's command.

 

(the vb project is targeting the .net framework 4, and the autocad2011 exe.config file has been de-commented to run .net 4. there appears plenty of system.windows.data errors too, as well as a couple of 'forgot to dispose?' i'm using the autocad sdk template 2011 on win7.)

 

the code itself runs most times, however, does also fatally crash stating 'FATAL ERROR: Unhandled Access Violation Reading 0x0000 at ea50bbe4h'.

 

although i seem to pin down the offending line in code, I have failed to overcome the problem in code and start wondering if it is really just down to the offending line in the code or actually related to the initial (above) error message.

 

help welcome, many thanks

1 REPLY 1
Message 2 of 2
StephenPreston
in reply to: adadnet

You'll see a lot of first chance exceptions in the output window when you start AutoCAD or any other large application from the debugger. An exception is not an error, so one being thrown does not necessarily indicate a problem - as long as it is caught and handled by the application. The problem comes when an exception is thrown and not caught/handled. That doesn't mean the exception you see isn't the source of the crash - but its not a smoking gun.

  

And the'forgot to dispose' warnings are there for a reason - they indicate you're leaving AutoCAD objects to be garbage collected instead of explicitly calling Dispose:

 

- The garbage collector runs on a different thread.

- AutoCAD is not multithread-safe.

- Therefore, not disposing something you should dispose can crash AutoCAD - quite possibly in the way you're seeing.

 

BTW That access violation indicates an attempt to acess a NULL pointer.

Cheers,

Stephen Preston
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost