<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic OnToolActivateAsync multifires, and then crash with chart in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877383#M5492</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&amp;nbsp; Furthermore, when I close the chart, ArcGIS Pro crashes.&amp;nbsp; &lt;A class="jivelink2" href="https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho" title="https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho"&gt;https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to prevent the multifiring of OnToolActivateAsync?&amp;nbsp; And not crashing would be nice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm in ArcGIS Pro 2.5.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To test this:&lt;/P&gt;&lt;P&gt;1. Make an add-in with a Pro MapTool.&amp;nbsp; No need for any additional code. Build (I built under Debug/Any CPU).&lt;/P&gt;&lt;P&gt;2. In Visual Studio, click Start. Place a breakpoint in OnToolActivateAsync on the line:&lt;/P&gt;&lt;PRE class="line-numbers language-csharp"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;base&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;OnToolActivateAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;active&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍  &lt;SPAN class="comment token"&gt;// breakpoint here&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;4. On the Add-In tab, click the tool to activate it. You should the breakpoint. Press F5 to let code execution continue.&lt;/P&gt;&lt;P&gt;5. Open the chart.&amp;nbsp; When I do this, I hit the breakpoint again.&amp;nbsp; It seems like I shouldn't hit the breakpoint unless I had clicked to activate my tool again.&lt;/P&gt;&lt;P&gt;6. Click the x to close the chart.&amp;nbsp; When I do this, Pro crashes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached are sample data, map file, and add-in code for a quick test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the crashing is a bug, and I sent the above description in the crash report.&amp;nbsp; I'm posting the question here primarily to answer the question about how to prevent OnToolActivateAsync from firing when a chart is opened.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 23 Apr 2020 01:09:42 GMT</pubDate>
    <dc:creator>TimWhiteaker</dc:creator>
    <dc:date>2020-04-23T01:09:42Z</dc:date>
    <item>
      <title>OnToolActivateAsync multifires, and then crash with chart</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877383#M5492</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;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.&amp;nbsp; Furthermore, when I close the chart, ArcGIS Pro crashes.&amp;nbsp; &lt;A class="jivelink2" href="https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho" title="https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho"&gt;https://utexas.box.com/s/qx1kidxsnufrgsobw1f83wd3aravjiho&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any way to prevent the multifiring of OnToolActivateAsync?&amp;nbsp; And not crashing would be nice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm in ArcGIS Pro 2.5.0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To test this:&lt;/P&gt;&lt;P&gt;1. Make an add-in with a Pro MapTool.&amp;nbsp; No need for any additional code. Build (I built under Debug/Any CPU).&lt;/P&gt;&lt;P&gt;2. In Visual Studio, click Start. Place a breakpoint in OnToolActivateAsync on the line:&lt;/P&gt;&lt;PRE class="line-numbers language-csharp"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;base&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;OnToolActivateAsync&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;active&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍  &lt;SPAN class="comment token"&gt;// breakpoint here&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;4. On the Add-In tab, click the tool to activate it. You should the breakpoint. Press F5 to let code execution continue.&lt;/P&gt;&lt;P&gt;5. Open the chart.&amp;nbsp; When I do this, I hit the breakpoint again.&amp;nbsp; It seems like I shouldn't hit the breakpoint unless I had clicked to activate my tool again.&lt;/P&gt;&lt;P&gt;6. Click the x to close the chart.&amp;nbsp; When I do this, Pro crashes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached are sample data, map file, and add-in code for a quick test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the crashing is a bug, and I sent the above description in the crash report.&amp;nbsp; I'm posting the question here primarily to answer the question about how to prevent OnToolActivateAsync from firing when a chart is opened.&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2020 01:09:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877383#M5492</guid>
      <dc:creator>TimWhiteaker</dc:creator>
      <dc:date>2020-04-23T01:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: OnToolActivateAsync multifires, and then crash with chart</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877384#M5493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tim,&lt;/P&gt;&lt;P&gt;When you activate the chart pane, Pro’s internally logic does the following:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Deactivates the current pane (map pane). This also means that the current map tool is deactivated. This is your custom tool.&amp;nbsp;&lt;/LI&gt;&lt;LI&gt;Then the chart pane is activated. This then activates the last active map tool (your map tool)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see the crash in Pro 2.5 when you close the Chart at this point.&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Uma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2020 22:41:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877384#M5493</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2020-04-23T22:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: OnToolActivateAsync multifires, and then crash with chart</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877385#M5494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Uma,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; Thanks for the info!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Apr 2020 23:10:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/ontoolactivateasync-multifires-and-then-crash-with/m-p/877385#M5494</guid>
      <dc:creator>TimWhiteaker</dc:creator>
      <dc:date>2020-04-23T23:10:43Z</dc:date>
    </item>
  </channel>
</rss>

