<?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 Re: How to avoid crash when add-in has a visible DockPane and cannot initialize? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662571#M13240</link>
    <description>&lt;P&gt;Why do you need to return false from&amp;nbsp;&lt;SPAN&gt;Module.Initialize()? There are many ways to disable functionality without returning false: conditions and etc.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 31 Oct 2025 17:28:10 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2025-10-31T17:28:10Z</dc:date>
    <item>
      <title>How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662045#M13233</link>
      <description>&lt;P&gt;If an ArcGIS Pro add-in has a DockPane that is currently visible and the add-in's overridden Module.Initialize() method returns false because it for some reason cannot initialize properly, ArcGIS Pro crashes.&lt;/P&gt;&lt;P&gt;How can that be avoided? I have tried to hide the DockPane in either Module.Initialize() or Module.Uninitialize(), but nothing seems to help.&lt;/P&gt;&lt;P&gt;I'm using ArcGIS Pro 3.5.3.&lt;/P&gt;&lt;P&gt;Steps to reproduce:&lt;/P&gt;&lt;P&gt;1. Start Visual Studio 2022 (17.14.18 in my case)&lt;BR /&gt;2. Create new project of type ArcGIS Pro Module Add-in&lt;BR /&gt;3. Right-click project in Solution Explorer, select Add-&amp;gt;New Item...&lt;BR /&gt;4. In the Add New Item dialog select 'ArcGIS Pro Dockpane' and click Add&lt;BR /&gt;5. Press Ctrl+F5 to build and run the project&lt;BR /&gt;6. When ArcGIS Pro starts create a new Map project&lt;BR /&gt;7. Click on the Add-In tab and click the 'Show Dockpane 1' button in 'Group 1'&lt;BR /&gt;8. Press Ctrl+S to save the project and close ArcGIS Pro&lt;BR /&gt;9. Open Module1.cs in Solution Explorer, override the Initialize() method, and make it return false.&lt;BR /&gt;10. Press Ctrl+F5 to build and run the project&lt;BR /&gt;11. When ArcGIS Pro starts, open the saved project&lt;BR /&gt;12. ArcGIS Pro crashes and displays the "ArcGIS Application has stopped working" dialog&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2025 20:45:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662045#M13233</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2025-10-29T20:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662435#M13238</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I would recommend to close dockpane before closing ArcGIS Pro. Start listen&amp;nbsp; ProjectClosingEvent in your dockpane:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        /// &amp;lt;summary&amp;gt;
        /// Override to implement custom initialization code for this dockpane
        /// &amp;lt;/summary&amp;gt;
        /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;
        protected override async Task InitializeAsync()
        {
                await base.InitializeAsync();

                ProjectClosingEvent.Subscribe(OnProjectClosing);
        }&lt;/LI-CODE&gt;&lt;P&gt;And on project closing close your dockpane:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        private Task OnProjectClosing(ProjectClosingEventArgs args)
        {
            // if already cancelled, ignore
            if (args.Cancel)
                return Task.CompletedTask;

            var vm = FrameworkApplication.DockPaneManager.Find(_dockPaneID);
            if (vm != null) vm.Hide();

            return Task.CompletedTask;
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 31 Oct 2025 07:20:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662435#M13238</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-10-31T07:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662543#M13239</link>
      <description>&lt;P&gt;Yes, thanks, that's one possibility.&lt;/P&gt;&lt;P&gt;But it's a bit inconvenient for the users, its like closing the Catalog pane for them whenever they close ArcGIS Pro. I would rather just close it if the add-in cannot initialize properly, and keep it open for them across sessions otherwise.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 16:01:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662543#M13239</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2025-10-31T16:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662571#M13240</link>
      <description>&lt;P&gt;Why do you need to return false from&amp;nbsp;&lt;SPAN&gt;Module.Initialize()? There are many ways to disable functionality without returning false: conditions and etc.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 17:28:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662571#M13240</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-10-31T17:28:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662581#M13241</link>
      <description>&lt;P&gt;For a few reasons.&lt;/P&gt;&lt;P&gt;Reading the &lt;A href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10515.html" target="_self"&gt;docs&lt;/A&gt; it looked like it is the recommended way to handle the case when the pre-requisites for an add-in to load isn't fulfilled. In this case there are several add-ins which should not be loaded if a certain configuration or other add-ins they are dependent on aren't loaded.&lt;/P&gt;&lt;P&gt;It would also be the easiest way to know whether a dependency is not available since FrameworkApplication.FindModule() returns null if the add-in's module returns false from Initialize(). Otherwise another mechanism to detect when an add-in couldn't be loaded must be implemented and spread throughout the development team.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 18:01:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662581#M13241</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2025-10-31T18:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662597#M13243</link>
      <description>&lt;P&gt;You can manage add-ins &lt;A href="https://www.esri.com/arcgis-blog/products/arcgis-pro/uncategorized/manage-arcgis-pro-add-in-loading" target="_self"&gt;dependencies&lt;/A&gt; on each other inside daml. ArcGIS Pro will manage order of loading your add-ins on information stored in daml.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 18:38:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662597#M13243</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-10-31T18:38:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662619#M13245</link>
      <description>&lt;P&gt;Yes, thanks, I know. But it's not the loading order that is the problem, it's avoiding that ArcGIS Pro crashes when some of them cannot load successfully.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 18:55:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1662619#M13245</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2025-10-31T18:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1663244#M13246</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/464288"&gt;@mahj&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One solution can be to:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Set the Autoload attribute of the addin to be true. You set this is in your addins's DAML. This allows the Module to initialize when Pro starts up.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;LI&gt;In your Module Initialization callback, before you return false, get the Dockpane and set its IsVisible property to false.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;LI-CODE lang="csharp"&gt; protected override bool Initialize()
 {
   //TODO: Be sure to add your business logic conditions for returning false, etc.
   DockPane pane = FrameworkApplication.DockPaneManager.Find("ProAppModule3_Dockpane1");
   if (pane != null)
     pane.IsVisible = false; 
   return false;
 }​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 16:26:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1663244#M13246</guid>
      <dc:creator>UmaHarano</dc:creator>
      <dc:date>2025-11-04T16:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid crash when add-in has a visible DockPane and cannot initialize?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1664987#M13249</link>
      <description>&lt;P&gt;Thanks, that worked!&lt;/P&gt;&lt;P&gt;But since the functionality in the add-ins are not always used, it would be good to lazy-load them to keep startup time shorter.&lt;/P&gt;&lt;P&gt;Any plans to make this work without setting autoLoad to true?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Nov 2025 20:06:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-to-avoid-crash-when-add-in-has-a-visible/m-p/1664987#M13249</guid>
      <dc:creator>mahj</dc:creator>
      <dc:date>2025-11-11T20:06:00Z</dc:date>
    </item>
  </channel>
</rss>

