Select to view content in your preferred language

VS.NET AWS Amazon WorkSpaces Add-in not working

1299
6
Jump to solution
11-29-2022 06:35 AM
JeraldAllen
Emerging Contributor

Hello all, I have written an ArcGIS Pro 3.0 Plugin. It is a simple application with just simple tasks. It works fine on a normal windows desktop but when running it on an Amazon WorkSpaces machine, the plugin shows up on the add-in ribbon, but the button says "This command is unavailable.".  Any known issues for working with Amazon Workspaces? Like I said, it works on a normal Windows desktop machine, but not on a machine running in the cloudon AWS. 

 

Capture.PNG

0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I duplicated the message that you are getting with my sample below.   I had to rename the class name or the namespace of the button's code behind in order to get this message.  

The correct code in my code-behind will work fine:

namespace SEAS.IENC.PICREP_TOOLS
{
    internal class PICREPButton : Button
    {
        protected override void OnClick()
        {
          MessageBox.Show("test");
        }
    }
}

But a renaming PICREPButton (which is case sensitive) will cause this message by Pro:

Test.pnger to get that message.  

View solution in original post

6 Replies
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I think what you referring to is an 'add-in' not a 'plugin'.  Add-ins are loaded 'JIT (Just In Time)' meaning that ArcGIS Pro doesn't run any of the 'add-in' code when Pro starts.   Pro waits until the UI triggers some action (like a button click), then Pro will try to find the class that is associated with the button click (we refer to as the code-behind).  Not seeing you add-in i can only speculate here, but it appears that Pro can't find the code behind on the AWS machine.  This is often the case when the add-in DLL has been renamed but the DLL references in the config.daml were not updated accordingly.  Or it is possible that your add-in threw an exception in the constructor.   Not sure why this works on your development machine, but i would suggest that you have different add-ins installed on your dev machine.  You can compare which add-ins are installed by using the 'Add-in Manager' menu under the 'Project' menu.

0 Kudos
JeraldAllen
Emerging Contributor

Thank you so much for the reply. Yes, I incorrectly said plugin in my original statement. Sorry about that. I will have to check with the client to make sure none of the files got renamed but the zip package I sent them as an installer are the files straight from my bin directory. (Pictured Below). Now, does the dll have to exist in the add-in's directory after they run the .addinx file? I noticed the installer just puts the add-in file but no dll's. That's the way it's always done in the past and worked, but I have not much experience in deploying. When they double click the .addinx file to install it, is that where it grabs the dll and packages it into the addinx in the installed folder? Maybe I should just have them copy the additional files to that folder? Anyways, thank you so much for your help with this. 

 

JeraldAllen_2-1669740651359.png

 

JeraldAllen_1-1669740550963.png

 

JeraldAllen_0-1669740513438.png

 

0 Kudos
Wolf
by Esri Regular Contributor
Esri Regular Contributor

I duplicated the message that you are getting with my sample below.   I had to rename the class name or the namespace of the button's code behind in order to get this message.  

The correct code in my code-behind will work fine:

namespace SEAS.IENC.PICREP_TOOLS
{
    internal class PICREPButton : Button
    {
        protected override void OnClick()
        {
          MessageBox.Show("test");
        }
    }
}

But a renaming PICREPButton (which is case sensitive) will cause this message by Pro:

Test.pnger to get that message.  

JeraldAllen
Emerging Contributor

I was finally able to reproduce this error as well. In order to do so, I had to make a new project and ported my code that was originally written for 2.9. The code that breaks on AWS was updated to 3.0 using the ESRI Migration Assistant.  The client tested that on both local desktop machines (that worked like mine) it was just breaking in the Cloud. I did have a couple of things I had to refactor when i started from scratch. One of them was I had to add a nuget package for system.drawing.common. I also took all the "." dots out of my name spaces and used underbars. So, unfortunately I introduced a few variables that fixed it, but in the midst of porting the code over to the new project, I did get this error when the names didnt match case wise in the config.daml file for the button.  Long post = THANK YOU ALL!!!!!

0 Kudos
Denny
by
Emerging Contributor

To your extra dll question above, you don't need to install any files other than the .esriAddinX file - it is a compressed archive containing what it needs. 

Charlie's diagnostic mode answer likely will log the error. You can start Pro in diagnostic mode with: 

    ArcGISPro.exe /enablediagnostics /loglevel=error

Then Pro will write an events log to your Documents\ArcGIS\Diagnostics folder. 

If that does not indicate the problem, then not being able to display the ribbon tooltip indicates an error occurring in the button's constructor. You can probably find the issue by debugging with a breakpoint in the button constructor.  If the error does not occur until you click the button, you can put the breakpoint in the button's OnClick() method. 

Also, as Wolf mentioned, renaming PICREPButton would cause this error; if this is the case, debugging will not hit breakpoints because the button won't load.  The case-sensitive class name must match what is in the Config.daml file:

<button id="SEAS_IENC_PICREP_TOOLS_PICREPButton" caption="PICREP Tools" className="PICREPButton" ... />

Hope this helps!

CharlesMacleod
Esri Regular Contributor

Try running Pro with diagnostic mode enabled and then check the log file. More information here: https://github.com/esri/arcgis-pro-sdk/wiki/ProGuide-Command-line-switches-for-ArcGISPro.exe#enable-... (you might need to create a shortcut that contains the cmd line argument)

It looks like your addin is getting loaded (as it appears on the ribbon) but is throwing an exception on creation (eg on a button click). There may be a dependency that is missing/not found but the log file should contain the exception and u can go from there.

0 Kudos