Deregister Navisworks Unhandled Exception Event

Anonymous

Deregister Navisworks Unhandled Exception Event

Anonymous
Not applicable

Hello,

 

This is in regards to the Unhandled Exception event on .Net Desktop Applications.

 

Currently, the desktop application I have developed can be used stand-alone and is accessible through Navisworks using a CommandPlugin.  I utilize the Unhandled Exception Event to catch all unhandled exceptions, based on the severity of the exception, it will be handled by my application.  This way I can centralize my error handling avoiding repeating code.

 

The issue is that when someone accesses the application through Navisworks, Navisworks gets first dibs on the Unhandled Exception event and pops up a generic dialog, then closes the application before it is handled by my application.  I know that event handling is on a first come first serve basis, so my options are to hope that the Navisworks API has something that I can utilize to avoid the application closing or to abandon the Unhandled Exception Event and have try/catch blocks on all functions that reference an error handling service.  

 

I have tried every variation of phrases in google I could think of to find answers to the following questions with no luck, so I am asking these here: 

  • Is it possible to deregister Navisworks unhandled exception event handler?
  • Is there anything in the Navisworks API to stop Navisworks from closing the application on exception?

Thank you

 

0 Likes
Reply
Accepted solutions (1)
1,270 Views
2 Replies
Replies (2)

Anonymous
Not applicable
Accepted solution

Hi,

 

I'd question your motivation to 'centralize' error handling, as catching errors the sooner you can would most likely lead to better handling and user experience. Letting errors surface all the way through doesn't seem like a good idea.

 

BUT, assuming you want to go through with it, if you simply wrap your commandplugin call into a try catch block, then all the errors happening within the context of your command should be intercepted there. Or am I missing something?

 

Nic

0 Likes

Anonymous
Not applicable

Hi Nic,

 

Thank you for your response.

 

In regards to your response to the centralization of error handling, it is more that if all else fails(i.e. an exception slips through the cracks) then the Unhandled Exception event I am trying to introduce can substitute for the Autodesk Unhandled Exception event and the event handler I have setup for my application can give the user an option to save whatever changes they have made within Navisworks and my plugin.  Then it will determine whether Navisworks needs to close.  This centralization is for unhandled exceptions that I am currently unaware of.

 

 

The command calls another application to tie the Navisworks interface to the application.  A try/catch block will finish immediately after it starts the application.  

 

You are right though.  I tried to see if there was a way I could get away with minimal error handling, which is not user friendly and if they are encapsulated in threads, it becomes a mess of AggregateExceptions.  I will go ahead with wrapping functions in try/catch blocks and create an exception handling service that the catch blocks will call.

 

Thank you,

Louay Rafih

 

0 Likes