I have an add-in that is throwing an exception that then crashes the ArcGIS Pro application. I have several try catch blocks but the error still bubbles up to the application. What is the recommend place to add code to protect the Pro application from an exception?
@RichardDaniels ,
Often the issue is that the exception is thrown on a different thread and unless your code is awaiting that thread, the try/catch won't work. See ProConcepts Asynchronous Programming in ArcGIS Pro · Esri/arcgis-pro-sdk Wiki for more details.
Does ESRI have a recommended way to add error catching at the highest level of a custom add-in to prevent crash of the ArcGIS Pro application when there is an error such as described here?
ArcGIS Pro has a built-in safeguard but you should ensure that your add-in is properly handling exceptions (to the best of your ability) or even outright avoiding them if you can test for boundary scenarios (see .NET best practices: Best practices for exceptions - .NET | Microsoft Learn).
ArcGIS Pro has a built-in safeguard...if you mean crashing and sending an error report then I guess it does 🙂.
What I was hoping to here is a recommendation on the best place to catch any errors thrown by QueuedTask.Run that were not waited upon. I'm updating a datagridview on windows form based on a Table.Search results after a mouse click (i.e., find points within 150 ft of the click mapPoint) then display results of the table in the datatable that has binding to the datagridview. It works without fail when run within Visual Studio in Debug mode; however, the table refresh fails after 3 to 5 uses in production.