Code Red > .NET

AutoCAD 2020 and Random System.AccessViolationExceptions

(1/5) > >>

lCine7ic:
Hi,

I've been working on a .Net Addin since AutoCAD 2009 and have been adapting/extending it over the years to work with the various versions of AutoCAD I've used (AutoCAD 2013, 2016, 2018 and now 2020).

It has run as expected in all versions until 2020.  Granted, there have been Exceptions thrown over the time but always due to errors in my code and acted predictably.  By predictably, I mean if there was an exception thrown, then unless I resolved it, it would continue to be thrown at the same line of code.

With AutoCAD 2020, I'm getting System.AccessViolationException thrown at different points of execution with really nothing else changing.  I have Visual Studio set to Debug the addin by running AutoCAD 2020 and opening a specific drawing file.  After that, I type a simple command to load the .Net Addin which goes through a set of initialization procedures for the drawing (loading blocks, initializing layouts, etc), BUT will ultimately terminate with a System.AccessViolationException at some point.  I'm not saving the file or anything along the way so I'd expect two consecutive Debug Runs to terminate at the same place, but it doesn't.  Heck, I've seen it throw the Exception when simply trying to Create a new XmlSerializer based on a custom Serialized class that I KNOW works.  It doesn't make ANY sense!

Funny thing is, the addin still works fine when ran in AutoCAD 2018.

Has anyone had similar issues?

Any recommendations?!  Any feedback you can provide is TRULY appreciated.

Best Regards,
Chris


It's Alive!:
Do you mean while the debugger is attached?

lCine7ic:
Yes -
--- Quote from: It's Alive! on March 06, 2020, 08:53:33 AM ---Do you mean while the debugger is attached?

--- End quote ---
Yes -- the System.AccessViolationException exceptions occur seemingly randomly with the Debugger attached.  Oddly enough, running the Addin without the Debugger attached allows the addin to startup / initialize completely, and then, without failing throws the System.AccessViolationException exception seemingly as soon as the program becomes quiescent.

Bryco:
Is there any document lock in there?  As I have seen that work then not work

It's Alive!:
Managed debugger has issues, but if your getting exceptions without the debugger attached, then its more than likely your code. I would start by adding a logger in your try..catch, (if you can catch it) output the message and the stack, this should help narrow things down.

Navigation

[0] Message Index

[#] Next page

Go to full version