.NET

Reply
Valued Mentor
DiningPhilosopher
Posts: 370
Registered: ‎05-06-2012
Message 11 of 12 (91 Views)

Re: Start-up & initialize

06-16-2013 11:05 AM in reply to: BlackBox_

BlackBox_ wrote:
Fair enough; so you're sayin something like:

if (<criteria is not met>)
throw new <?.>Exception();

... Would do the trick?

Yes.  The managed runtime loader will catch any exception thrown.  If the OP wants to inform the user that the commands are not available, he can display a message before throwing the exception.

Distinguished Mentor
BlackBox_
Posts: 785
Registered: ‎02-25-2013
Message 12 of 12 (84 Views)

Re: Start-up & initialize

06-16-2013 11:50 AM in reply to: DiningPhilosopher

DiningPhilosopher wrote:

BlackBox_ wrote:
Fair enough; so you're sayin something like:

if (<criteria is not met>)
throw new <?.>Exception();

... Would do the trick?

Yes.  The managed runtime loader will catch any exception thrown.  If the OP wants to inform the user that the commands are not available, he can display a message before throwing the exception.


Thank you for clarifying... Perhaps in error, I picked up that this was 'a bad thing' to do in Initialize, and didn't realize one could intentionally employ Exceptions to prevent other assembly code from being loaded.

 

In contrast, I did learn from Gile's LispException helper Classes that one could do so when evaluating a ResultBuffer; I clearly didn't connect the dots.

 

As always, I appreciate the knowledge you share with the community.

 

Cheers



"Potential has a shelf life." - Margaret Atwood


Autodesk Exchange Apps ~ Autoloader ~ AutoCAD Security


AutoCAD® 2014, and Civil 3D® 2014 Certified Professional ~ Autodesk® Authorized Developer

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!