Errors encountered by the SIS control will raise exceptions and the code will terminate.
Methods which are expected to throw an exception must be contained in a Try…Catch block.
The SIS GisLink property should be disposed (and set to nothing) outside the Try…Catch block to ensure the application will orderly release control if the code terminates with an exception.
It is important to catch exceptions in an in-process application. Failure of an in-process Add-in will cause the SIS application to stall.
For example it is common to store items in a list object. The contents of a list persist; therefore it is good practice to empty the list before populating it with new items.
Emptying a list will also erase the list; this means calling the EmptyList method on a list which is already empty will raise an exception.
If it is expected that a list is empty, then the EmptyList method must be called within a Try…Catch block.
Note: The caught exception can be displayed to the user.