*Expert Elite*
Posts: 1,569
Registered: ‎10-08-2008
Message 11 of 14 (203 Views)

Re: Fatal Exception when running code

05-25-2012 10:56 AM in reply to: bkenyon13

Good point

Thanks for the sharing with community

Cheers :smileyhappy:



New Member
Posts: 2
Registered: ‎01-14-2010
Message 12 of 14 (186 Views)

Re: Fatal Exception when running code

05-26-2012 02:40 AM in reply to: bkenyon13



does not the "Exit for" without any condition cause the code to leave the loop inside the first round? Maybe you are not going to reach your problem anymore......


Christian Blei

Active Contributor
Posts: 45
Registered: ‎04-20-2012
Message 13 of 14 (179 Views)

Re: Fatal Exception when running code

05-26-2012 08:14 AM in reply to: ChristianBlei7416

what I found was while this solved the fatal error it stopped copying the pagesetups.

So I did some troubleshooting and realized the the curps.dispose was the issue with it not copying the pagesetup


however I also discovered that if I removed the exit for and/or the curps.dispose I would get the fatal error again.

so in order for my code to work and copy the pagesetups without giving me the fatal error I had to stop/unload the curps without using curps.dispose and exit for.


so a long story somewhat short I did this:

using curps as plotsettings = new plotsettings(false)

(did work)

end using


This allowed me to copy the pagesetups as I wanted and not get a fatal error in the resulting code I removed all exit for's.  What I learned from this is that you have to make sure that everything gets unloaded even the littlest thing still hanging out there can cause an error.


Hope this helps.

Posts: 17
Registered: ‎06-13-2013
Message 14 of 14 (113 Views)

Re: Fatal Exception when running code

06-24-2013 07:44 PM in reply to: bkenyon13



I understand that this thread is over a year old, and am not sure if posting here will still elicit a response. 

If it does not, I will post again. 


it seems that kenyon is saying that you havet to dispose of the variables as soon as you are done using it. 

That means assigning the plot setting to a variable is out of question?

I am trying to write a function that simply returns the plot settings to the mother routine, based on the paper size the user picks in a form. 


I am having no luck in preventing the autocad crash once it cycles through two or three of the page setups. 

Intially, it cycled through all layout page setups. 

And trying to get it to read any page setup that is not in a layout is out of the question. 


Please help. 





Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.