|
POST
|
Solution: As suggested I changed load autoLoad="true" in my Module in the config.daml. I moved my long running task into the OnToolActivateAsync event with wrapper code to ensure it only is run the 1st time the button/Tool is clicked on the Ribbon. I Activate the tool with FrameworkApplication.State.Activate in the initial class constructor and setup a new event handler to 'catch' all UI codes that are not caught explicitly within the application this (1) protects ArcGIS Pro itself from crashing and (2) allows me to do .Deactivate if the add-in has an unhandled error. In the modules class, defined in the config.daml as SRView4ProTool, I update the constructor as follows and configured the data handler. public SRView4ProTool() { if (getEnterpriseTableConnection() == null) //if this is null then this is the first time clicked on the add-in during the session, this could just be a public static int runCount but I'm using my data connection that was setup in OnToolActivateAsync { // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += new ThreadExceptionEventHandler(ErrorHandler_UIThreadException); // Set the unhandled exception mode to force all Windows Forms errors to go throughour handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); //set the state FrameworkApplication.State.Activate("srview_state"); } IsSketchTool = true; SketchType = SketchGeometryType.Point; SketchOutputMode = SketchOutputMode.Map; } I then add the event handler code private static void ErrorHandler_UIThreadException(object sendor, ThreadExceptionEventArgs t) { DialogResult result = DialogResult.Cancel; result = MessageBox.Show("Fatal Windows Form Error. Would you like to try to continue OR Cancel/Close the Add-In?", "Fatal Windows Forms Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); // Exits the program when the user clicks Cancel. if (result == DialogResult.Cancel) { formResults.btnClose_Click(sendor, t); FrameworkApplication.State.Deactivate("srview_state"); } }
... View more
03-05-2025
04:19 PM
|
0
|
0
|
1478
|
|
POST
|
Just be aware that adding .Result causes the thread to wait until a Result is available to assign to strMsgs.
... View more
03-05-2025
10:53 AM
|
0
|
0
|
1242
|
|
POST
|
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.
... View more
03-05-2025
10:14 AM
|
0
|
0
|
664
|
|
POST
|
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?
... View more
03-05-2025
09:10 AM
|
0
|
2
|
675
|
|
POST
|
In regards to your installation package, one way to get around some of the installer flags is to use Orca to edit the MSI directly. Most or all the flags you may set at the Command Line can be found in the Properties Table within your MSI (turns out an MSI is just a database file ;-). 1. If you are seeing many users with HKCU values within their registry it is because you have Per User installations. This is Bad since it causes the issues you describe and make managed deployments difficult. 2. We need a script to iterated through all users in HKEY_USERS and deleted HKEY_USERS\<unique user GUID Here>\Software\ESRI\ArcGISPro\Licensing. An example of is idea can be found at recursion - Registry - HKEY_USERS Recursively Delete Key (VBS) - Stack Overflow
... View more
03-05-2025
08:55 AM
|
0
|
0
|
2081
|
|
POST
|
HKEY Current User is stored in the users profile. If you looked in HKCU registry when different users are logged into the same computer you will see different registry settings. When you run an MSI install with ALL User = 1 the installation cannot, overwrite individual HKCU registry settings because it is running as the System account. By design, HKCU overrides HKEY_LOCAL_MACHINE.
... View more
03-05-2025
08:41 AM
|
0
|
1
|
2082
|
|
POST
|
Instead of using Export and Save to a PDF, Print to PDF instead (you do have a PDF driver installed, such as Microsoft Print to PDF?) and compare the results. This will confirm if it is an issue with invisible data frames as discussed by Aubri
... View more
03-04-2025
08:56 AM
|
0
|
0
|
2040
|
|
POST
|
does MapView.Active.Map.MoveLayer(workflowLocGroupLayer, 0); cause a redraw action on the screen? If so there is a possibility that first MoveLayer is not completed at the time your next call is made.
... View more
02-28-2025
09:33 AM
|
0
|
1
|
1411
|
|
POST
|
But await does not actually cause the code to Wait 🙂
... View more
02-27-2025
02:45 PM
|
0
|
0
|
748
|
|
POST
|
In you example if we had a line 9, that did more work (e.g., getting t2.Result), would your code Wait till the task is completed before running line 9?
... View more
02-27-2025
02:40 PM
|
0
|
0
|
748
|
|
POST
|
One thing to check is 'Where' your ArcGIS License Server is located. I now recall that that the MAC address you were referring to is actually from the HARD DRIVE that the license repository is saved to on the License Server. Why can this be a problem? If your License Server is hosted in a Virtual Machine (VM), unless told otherwise, you cannot guarantee that the assigned physical hard drive will not 'change' every time you Reboot the Server. When this happens your license repository can become invalid.
... View more
02-27-2025
12:19 PM
|
0
|
0
|
3716
|
|
POST
|
QueuedTask is used to schedule tasks to run on the MCT (thread). Based on my reading, there is only One MCT thread (please correct me if I'm wrong). They start in the order they are queued BUT we do not know when they will be done. As you say, you start method1, method2 but in some cases method2 is Completed before method1. That is why one can use Task.WaitAll() or Task.Wait() to ensure a result is available for the next Step in our code. One thing I did Today that appears to be working was refactor my code to reduce the number of nested QueuedTasks and then used Return to explicitly return a result to avoid NullObjectExceptions. MapPoint mapPoint; Task<MapPoint> t2a = QueuedTask.Run(() => { MapPoint mapPoint0; mapPoint0 = MapView.Active.ClientToMap(e.ClientPoint); //add graphic to the map AddPointGraphicAsync(mapPoint0); return mapPoint0; }); t2a.Wait(); mapPoint = (MapPoint) t2a.Result; Task t2b = QueuedTask.Run(() => { //do more work and use the mapPoint for SelectingRowsFromATable, this requires a QueuedTask });
... View more
02-27-2025
12:12 PM
|
0
|
3
|
1441
|
|
POST
|
Have you reviewed Using the ArcGIS License Server Administrator—License Manager Guide | Documentation? What is the file extension for the license file you are downloading/receiving from ESRI, if .prvs (provisioning) they actually don't contain any MAC addresses and you should be able to ADD them to your license server. If you have Maintenance I think this question merits one for support.esri.com
... View more
02-26-2025
04:35 PM
|
0
|
1
|
3742
|
|
POST
|
The add-in connects to a SQL Feature Class with about 1,232,000 points using Geodatabase.OpenDataset<Table> on startup. This is done on the load event to ensure it only happens once (not each time the tool is clicked on the ribbon).
... View more
02-26-2025
04:07 PM
|
0
|
0
|
1600
|
|
POST
|
Has anyone encountered this issue and have a better work around? Many of the commonly used methods in ArcGIS Pro SDK are required to be run on the 'MCT' thread. The code is wrapped in a QueuedTask.Run block and in most cases, we need to Wait for the result before continuing processing. This is often done with Task.Wait(). However, I've recently ran into a situation where Task.Wait throws an ERROR because the task has a status of TaskStatus.WaitingForActivation. Is this a known issue? Task t1 = QueuedTask.Run(() => { try { //do some long running work } catch (Exception eX) { // handle the error } }); //code added to prevent error while (t1.Status==TaskStatus.WaitingForActivation) { Thread.Sleep(500); loopCount++; if (loopCount > 22) // 11 seconds max wait time { break; } } if (t1.Status==TaskStatus.WaitingForActivation) { throw new exception("Task failed to Start within 11 seconds."); } t1.Wait();
... View more
02-26-2025
10:50 AM
|
0
|
3
|
803
|
| Title | Kudos | Posted |
|---|---|---|
| 7 | 2 weeks ago | |
| 1 | 12-17-2025 12:46 PM | |
| 1 | 11-24-2025 01:43 PM | |
| 1 | 11-25-2025 09:49 AM | |
| 1 | 07-31-2025 08:54 AM |
| Online Status |
Offline
|
| Date Last Visited |
yesterday
|