Custom DAML Component Not Registering Kind Of

838
6
05-11-2022 03:28 PM
KierenTinning2
New Contributor III

All, very annoying and thorny problem.

Solution A - I have defined a new DAML category

<insertCategory id="my_special_tool"/>

This solution has an ArcGIS Dockpane which loads in Embeddable Controls using the ContentPresenter pattern.  This works quite well.

Solution B - Has 2 projects which contain the embeddable controls (defined as ArcGIS Modules, with Embeddable controls added) 

In the categories section in their DAML's I have

<categories>
<updateCategory refID="my_special_tool">
<insertComponent id="Control1" className="Control1ViewModel">
<content className="Control1View" displayName="Control1" />
</insertComponent>
</updateCategory>
</categories>

and the second is

<categories>
<updateCategory refID="my_special_tool">
<insertComponent id="Control2" className="Control2ViewModel">
<content className="Control2View" displayName="Control2" />
</insertComponent>
</updateCategory>
</categories>

I can build both modules and see them get added as addins to the Pro system.  When I start Pro and load my dockpane I can issue the call

var cat = Categories.GetComponentElements("my_special_tool")

I used to get both addins (Controls), then suddenly my second addin just stopped working.  No matter what I try, deleting the addin cache, rebooting, nothing will enable the second one to be seen.  It is almost like Pro, on startup isn't reading the second addin's DAML file (though I can see it's installed).  Using the GetComponentCategories, it returns only the 1st solution and not the second.

Any thoughts / options / troubleshooting tips would be much appreciated.  I have had this before and I just created a new solution, but surely there must be a better way of dealing with components that just stop loading in Pro.

Thank you

Tags (3)
0 Kudos
6 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You need to specify second module dependencies in daml like this:

  <dependencies>
    <!-- id of "Add-in First" -->
    <dependency name="{45998990-895f-4d92-bbde-ff70d25adac2}" />
  </dependencies>
KierenTinning2
New Contributor III

I am not sure what you mean?  The two components in the second solution are independent of each other (i.e. no dependencies).  What I discovered is some of the references in Control2 were broken, I removed them and added in the ArcGIS Pro Extensions nuget, it build just fine.  

Otherwise the two DAML's (Control1 and Control2) are the same (aside from class and viewmodel names, etc).  What was really bizarre, is it worked for days, then suddenly Pro just stopped registering Control2.  I did upgrade my Visual Studio, so it hypothetically could be related to that, but one would have thought both embeddable controls would have broken, not just one of them

0 Kudos
GKmieliauskas
Esri Regular Contributor

It depends on module loading order. If your second module is loaded first, then second module can't find refID="my_special_tool" which I understand is defined in first module. So to access refID's from another module you need to define dependencies.

First module dependency ID you can find in daml line:

 

  <AddInInfo id="{45998990-895f-4d92-bbde-ff70d25adac2}" version="1.134" desktopVersion="2.9.00000">

 

 

0 Kudos
KierenTinning2
New Contributor III

Ah, my apologies.  No, solution 1 is acting as the Host and has the Host control - it is the one that defines the component category.

Solution 2 has two independent modules (embeddable controls) which the Host Control needs to see and be able to load depending on conditions present.

The modules in solution 2 do not need to see each other and have no dependencies between them.  It is only solution 1 (Host) which needs to load the addins.  

When I call  var cat = Categories.GetComponentElements("my_special_tool")

cat should have two (or more entries) for the components which implement that DAML element.  It did work, then something broke.  So I know it's not inherently wrong, I am trying to trouble shoot why Pro just stopped seeing the one module and attempting to avoid moving it into a new solution which Pro can see and load

0 Kudos
GKmieliauskas
Esri Regular Contributor

So as I understand you have three modules?

Then Solution2  both modules must have dependencies to Host module. That changes allow predefine module loading order for ArcGIS Pro. Solution A will be loaded first and then Solution B modules in random order

0 Kudos
KierenTinning2
New Contributor III

Yes, both sub modules implement the category through <updateCategory refID="my_special_tool"> and both contain an defined interface which allows for communication between the host and the embeddable components.  

It's a very odd problem - it's almost like Pro just isn't incorporated the control1 embeddable control, I can see it's installed in the Pro Addin's manager, but Pro just isn't readying the config.daml from it

0 Kudos