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

Unhandled Exceptions

9 REPLIES 9
Reply
Message 1 of 10
jhay2009
494 Views, 9 Replies

Unhandled Exceptions

I program in Lisp mostly and normally when one of my programs crash it stops and echos some verbage at the command line. However, whenever I run a co-workers ARX program and it crashes, it always takes the entire session of AutoCAD down with it right after a dialog box says there was an unhandled exception. I've talked to him about it and he says that it's just the way it is. Can anyone tell me if this is true or not? Is there maybe some code he's missing that would keep AutoCAD from closing everytime there's an error?
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: jhay2009

Your co-worker's ARX program is buggy, and
you probably shouldn't use it. There are ways
to trap exceptions, but that doesn't serve as an
excuse for deploying bug-infested software.

Unless your co-worker is a professional programmer,
he should probably find something less dangerous
to do with his free time.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6140554@discussion.autodesk.com...
I program in Lisp mostly and normally when one of my programs crash it stops
and echos some verbage at the command line. However, whenever I run a
co-workers ARX program and it crashes, it always takes the entire session of
AutoCAD down with it right after a dialog box says there was an unhandled
exception. I've talked to him about it and he says that it's just the way it
is. Can anyone tell me if this is true or not? Is there maybe some code he's
missing that would keep AutoCAD from closing everytime there's an error?
Message 3 of 10
PrashantSL
in reply to: jhay2009

Hi Tony,

I am experiencing ACAD crashes randomly. But mostly on close of file.
I have developed a ARX module which uses .NET GUIs to interact with users. I registered the command which will launch these GUI with flag "ACRX_CMD_TRANSPERENT | ACRX_CMD_SESSION ". Then I perform some operation of the drawing files. Like opening, setting attributes, saving etc.
But ACAD crashes mostly when I close any opened file. It gives "Unhandled access violation" errors. I have put try catch blocks at most of the places but nothing gets caught. Feeling like I am lost!

Can you please give some help on this? Few questions:
1. If I have modal dialog boxes then too I have to register command which will launch them as ACRX_CMD_SESSION?
2. If I create AcDbDabase object(as AcDbDatabase* pDb = new AcDbDatabase(false, true)) & then readDwgFile() to read a drawing file which is not opened in ACAD. Then how can I manage locking unlocking of it? Or locking/unlocking is possible on opened documents only?

Thanks a lot and desperately waiting for your helping hand!

Prashant.
Message 4 of 10
jhay2009
in reply to: jhay2009

When I asked my co-worker about adding some error code to his programs he said there are just to many places where errors can occur and it would be impossible to try to catch them all. He obviously thinks he would need to add error catching code at all these places rather than in just one general location that would catch all exceptions from a single point on. Is he right about this?

By the way, my co-worker has been programming for 10+ years but to be honest his programs are not known for being streamlined in my opinion are overly complicated. Also, they are very useful to our company so we have zero chance of working around them.

Please help me understand something however, are unhandled exceptions the only type of errors found in ARX programs or possibly just the critical ones? Meaning if his program tried to insert a block that couldn't be found would that be considered an unhandled exception and cause AutoCAD to crash?
Message 5 of 10
Anonymous
in reply to: jhay2009

Once an unhandled exception occurs, the state of the AutoCAD editor is
potentially unrecoverable. An exception handler is very specific and can be
written for a small section of the code to recover from this unknown state.
The handler must be written to specifically recover from the condition that
caused the exception without resulting in any corruption of the AutoCAD
state, otherwise it just makes matters worse by allowing AutoCAD to continue
executing in an unknown state. 🙂
--
Owen Wengerd
President, ManuSoft <>
VP Americas, CADLock, Inc. <>
Message 6 of 10
Anonymous
in reply to: jhay2009

There's far too many causes for those types of errors for me or
anyone to tell you anything about how to solve the problem, knowing
little or nothing about the code.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6141064@discussion.autodesk.com...
Hi Tony, I am experiencing ACAD crashes randomly. But mostly on close of
file. I have developed a ARX module which uses .NET GUIs to interact with
users. I registered the command which will launch these GUI with flag
"ACRX_CMD_TRANSPERENT | ACRX_CMD_SESSION ". Then I perform some operation of
the drawing files. Like opening, setting attributes, saving etc. But ACAD
crashes mostly when I close any opened file. It gives "Unhandled access
violation" errors. I have put try catch blocks at most of the places but
nothing gets caught. Feeling like I am lost! Can you please give some help
on this? Few questions: 1. If I have modal dialog boxes then too I have to
register command which will launch them as ACRX_CMD_SESSION? 2. If I create
AcDbDabase object(as AcDbDatabase* pDb = new AcDbDatabase(false, true)) &
then readDwgFile() to read a drawing file which is not opened in ACAD. Then
how can I manage locking unlocking of it? Or locking/unlocking is possible
on opened documents only? Thanks a lot and desperately waiting for your
helping hand! Prashant.
Message 7 of 10
Anonymous
in reply to: jhay2009

Your co-working is selling you a bill of goods.

The problem isn't that he can't insert error handling code
everywhere, the problem is that his code doesn't bother
to check for conditions that cause errors and avoid doing
whatever it is that triggers them.


As per your example, when a programs does things like
inserts blocks, they are supposed to check to see if the
block exists first, and not try to insert it if it doesn't. And
that's an example of where not testing for the conditions
that result in an error, is what causes them.

If the error can be reproduced, than the way to find it is
to run the code in the debugger, which can be set to break
on an exception. The point where the debugger breaks is
not necessarily where the cause of the error is, but rather
where it manifests in the form of an exception.

It seems to me from your description that your co-worker
is not a very skilled programmer, and that means that his
code isn't going to save you money, it's going to cost you
money as a result of lost work.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6141173@discussion.autodesk.com...
When I asked my co-worker about adding some error code to his programs he
said there are just to many places where errors can occur and it would be
impossible to try to catch them all. He obviously thinks he would need to
add error catching code at all these places rather than in just one general
location that would catch all exceptions from a single point on. Is he right
about this? By the way, my co-worker has been programming for 10+ years but
to be honest his programs are not known for being streamlined in my opinion
are overly complicated. Also, they are very useful to our company so we have
zero chance of working around them. Please help me understand something
however, are unhandled exceptions the only type of errors found in ARX
programs or possibly just the critical ones? Meaning if his program tried to
insert a block that couldn't be found would that be considered an unhandled
exception and cause AutoCAD to crash?
Message 8 of 10
jhay2009
in reply to: jhay2009

Thanks for all your feedback. The good news is that I don't believe my co-worked was trying to deceive anyone by creating sloppy code but rather as you said, just not very skilled at what he does and therefor doesn't know any better. I'll have to try to talk to him some more about this and see where it goes. Thanks again...
Message 9 of 10
Anonymous
in reply to: jhay2009


He will learn a lot from professionals like
Tony and Owen.

 

I am still learning and have followed
all the great adviced they had posted here in these newsgroups as well the
ones directly from them (among some of the other masters around
here).

 

 

I know, but I want it to say it and also to
thank them one more time 🙂

 

 

 

Best regards,

Luis.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Thanks
for all your feedback. The good news is that I don't believe my co-worked was
trying to deceive anyone by creating sloppy code but rather as you said, just
not very skilled at what he does and therefor doesn't know any better. I'll
have to try to talk to him some more about this and see where it goes. Thanks
again...
Message 10 of 10
Anonymous
in reply to: jhay2009

Thanks for the kind words Luis! 🙂
--
Owen Wengerd
President, ManuSoft <>
VP Americas, CADLock, Inc. <>

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

Post to forums  

Autodesk Design & Make Report

”Boost