ArcGIS Pro: Stop queuing senseless "UI Tasks" (performance issue)

Idea created by mboeringa2010 on Aug 2, 2018
    • JMKling
    • mboeringa2010
    • jschwartz@fcgov.com_fcgov
    • mvolz47
    • WiscRapids
    • Hornbydd
    • RudmaTek_AU
    • RBannister@unimin.com_UniminCorp
    • friedcc

    This is something that has been bothering me from the beginning with Pro. It appears Pro queues literally every action done against the TOC (Table Of Contents) as triggers for toolvalidation or other UI refresh tasks, even if the entire context of the TOC changed due to subsequent changes, and the toolvalidation requests are in fact invalidated by the changed context (new or removed layers).

    This is a real problem with any form of automation using Python and arcpy, and especially those using the arcpy mapping module, that is in fact is supposed to allow you to automate your mapping.

    As an example, I have a script that automates adding layers to the TOC of a map. It adds hundreds of them, one by one using arcpy AddLayer requests. This is no problem in ArcMap, the tool will run and finish in a normal fashion in ArcMap.

    Not so in Pro: for every action against the TOC, whether it is the actual addition of the layer or setting layers visible or invisible using arcpy, Pro seems to queue up UI refresh "tasks" and toolvalidation requests and create an extremely long list of "pending" tasks. As a consequence, after a tool that modifies the TOC has finished as witnessed by a "Completed" message, Pro continuous to show toolvalidation code running in the tool's dialog, and needlessly blocks the entire interface for hours. See the image below showing also the output of ArcGIS Pro Monitor, with the UI task list.

    This is not just a problem with automation through arcpy. Adding or removing many (hundreds) of layers by simple cut&paste operations, may cause similar issues.

    What in my opinion should happen: if there is still a task / toolvalidation request pending, but a subsequent action against the TOC of Pro causes a significant change (addition / removal of layer, layer being set visible/invisible), whether through automation using arcpy or manually, then any pending UI refresh task / toolvalidation requests should be dropped immediately from the queue. If the context changes, the toolvalidation request are invalid anyway: e.g. imagine a tool parameter showing a list of layers present in TOC: if a layer is removed from the TOC, then any toolvalidation request / trigger will be invalid if it references the situation before the removal of the layer.



    Full display of function causing the issues: