<?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: Struggling to auto-load and initialize a module in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1562946#M12337</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have modified ArcGIS Pro SDK Community sample &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/InspectorTool" target="_self"&gt;InspectorTool&lt;/A&gt;. I have changed autoload to true. It works as expected. Initialize event arises before ArcGIS Pro starts (on splash screen). Check project target framework (.NET8.0) version and&amp;nbsp;&amp;nbsp;desktopVersion in config.daml file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GKmieliauskas_0-1732693273806.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120471i6A141D1A8503630F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GKmieliauskas_0-1732693273806.png" alt="GKmieliauskas_0-1732693273806.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 27 Nov 2024 07:41:26 GMT</pubDate>
    <dc:creator>GKmieliauskas</dc:creator>
    <dc:date>2024-11-27T07:41:26Z</dc:date>
    <item>
      <title>Struggling to auto-load and initialize a module</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1562777#M12334</link>
      <description>&lt;P&gt;I just modified our module for ArcGIS Pro v3.3 (excerpt of Config.daml below) to auto-load.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;modules&amp;gt;
  &amp;lt;insertModule id="WREdit_Module" className="WREditModule" autoLoad="true" caption="WREdit"&amp;gt;
    &amp;lt;tabs&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Despite this, the static constructor doesn't run any earlier than it previously did--for example, until I click a button defined within the module.&lt;/P&gt;&lt;P&gt;I also recently created a non-static constructor and overloads of Initialize() &amp;amp; Uninitialize().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;public WrEditModule()
{
    LogExceptionToFile(new Exception("ctor"));
    Log.Information("ctor");
    _wrEditLauncherPipeServer = GetDependency&amp;lt;WrEditLauncherPipeServer&amp;gt;();
    _wrEditLauncherPipeServer.Run();
}

protected override bool Initialize() //Called when the Module is initialized.
{
    LogExceptionToFile(new Exception("Initialize"));
    Log.Information("init");
    _wrEditLauncherPipeServer = new WrEditLauncherPipeServer();
    _wrEditLauncherPipeServer.Run();
    return base.Initialize();
}

protected override void Uninitialize() //Called when the Module is shut down.
{
    LogExceptionToFile(new Exception("Uninitialize"));
    Log.Information("uninit");
    _wrEditLauncherPipeServer.Stop(); // Stop the pipe server
    base.Uninitialize();
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But none of that stuff &lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;ever&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt; happens.&amp;nbsp; Everything we've put in there so far is static (following the convention described in &lt;A title="documentation for the Module class" href="https://pro.arcgis.com/en/pro-app/latest/sdk/api-reference/topic10500.html" target="_blank" rel="noopener"&gt;the doc&lt;/A&gt;), but I'd expect that an API documented with non-static members would . . . y'know . . . instantiate an object at some point. What am I missing?&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;I could handle this statically if necessary, but I need to run the `_wrEditLauncherPipeServer.Stop()` method before ArcGIS Pro is closed.&amp;nbsp; How can I ensure that happens in a static context?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2024 21:45:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1562777#M12334</guid>
      <dc:creator>DanNarsavage_IDWR</dc:creator>
      <dc:date>2024-11-26T21:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: Struggling to auto-load and initialize a module</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1562946#M12337</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I have modified ArcGIS Pro SDK Community sample &lt;A href="https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Editing/InspectorTool" target="_self"&gt;InspectorTool&lt;/A&gt;. I have changed autoload to true. It works as expected. Initialize event arises before ArcGIS Pro starts (on splash screen). Check project target framework (.NET8.0) version and&amp;nbsp;&amp;nbsp;desktopVersion in config.daml file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GKmieliauskas_0-1732693273806.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/120471i6A141D1A8503630F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GKmieliauskas_0-1732693273806.png" alt="GKmieliauskas_0-1732693273806.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 07:41:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1562946#M12337</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2024-11-27T07:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Struggling to auto-load and initialize a module</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1563057#M12338</link>
      <description>&lt;P&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;TL;DR: Class names in the DAML are case-sentitive.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply!&amp;nbsp; Project target was already at 8.0, and I changed the desktopVersion value from "3.3.0" to "3.3.52636" based on what I saw in my "Add/Remove Programs" interface (although Pro itself simply reported 3.3.0).&amp;nbsp; Those changes had no effect.&lt;/P&gt;&lt;P&gt;But your suggestion prompted me to inspect the DAML more closely and (after many other ineffectual attempts) I noticed that the module class is declared in C# as "W&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;r&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;EditModule" while it is cited in the DAML as "W&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;R&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;EditModule".&amp;nbsp; Changing the DAML to match the C# did the trick (after rolling back all my other changes).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Good grief, every bit of five hours of work to change one character.&amp;nbsp; Reminds me of &lt;A title="Never rewrite an application from scratch" href="https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/" target="_self"&gt;Joel Spolsky's wisdom&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Nov 2024 18:47:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/struggling-to-auto-load-and-initialize-a-module/m-p/1563057#M12338</guid>
      <dc:creator>DanNarsavage_IDWR</dc:creator>
      <dc:date>2024-11-27T18:47:51Z</dc:date>
    </item>
  </channel>
</rss>

