If an add-in tool is active, it looks like when you open a chart, OnToolActivateAsync fires again, causing my code to be executed again. Furthermore, when I close the chart, ArcGIS Pro crashes. https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho
Is there any way to prevent the multifiring of OnToolActivateAsync? And not crashing would be nice.
I'm in ArcGIS Pro 2.5.0.
To test this:
1. Make an add-in with a Pro MapTool. No need for any additional code. Build (I built under Debug/Any CPU).
2. In Visual Studio, click Start. Place a breakpoint in OnToolActivateAsync on the line:
return base.OnToolActivateAsync(active); // breakpoint here
3. Start a Pro project with a map. Add a table and make a chart. I tried line and bar charts from two numbers fields and the result was the same, so I suspect chart type doesn't matter. If the chart pane is open, then close it.
4. On the Add-In tab, click the tool to activate it. You should the breakpoint. Press F5 to let code execution continue.
5. Open the chart. When I do this, I hit the breakpoint again. It seems like I shouldn't hit the breakpoint unless I had clicked to activate my tool again.
6. Click the x to close the chart. When I do this, Pro crashes.
Attached are sample data, map file, and add-in code for a quick test.
I think the crashing is a bug, and I sent the above description in the crash report. I'm posting the question here primarily to answer the question about how to prevent OnToolActivateAsync from firing when a chart is opened. Thanks!
Solved! Go to Solution.
Hi Tim,
When you activate the chart pane, Pro’s internally logic does the following:
I see the crash in Pro 2.5 when you close the Chart at this point. Good news - I have tried this multiple times in Pro 2.6 which is in development right now. No crash happens. So that has been fixed.
Thank you!
Uma
Hi Tim,
When you activate the chart pane, Pro’s internally logic does the following:
I see the crash in Pro 2.5 when you close the Chart at this point. Good news - I have tried this multiple times in Pro 2.6 which is in development right now. No crash happens. So that has been fixed.
Thank you!
Uma
Hi Uma,
It sounds like I'll have to take that into consideration regarding tool activation, and I'll just notify users of the crash fix in 2.6. Thanks for the info!
Tim