Very simple ArcMap add-in freezes

479
5
09-25-2013 07:02 AM
SteveMarotta
New Contributor
I'm working with ArcMap add-ins for the first time, and I'm having some trouble with it. I tried looking up the problem I'm having and I can't seem to find anything that mentions it. I just wrote a very, very simple ArcMap add-in. All it does is pop up a simple "Hello World" dialog box, per the example in the ArcGIS documentation. I've got a command, or "button", created, and I've got the button contained in a toolbar. When I open ArcMap, the toolbar shows up, the button shows up, and when I press the button, the whole ArcMap application hangs. When I try to debug the code, I see that it's successfully entering the "onClick" method, but when I try to execute the showDialog, the whole ArcMap application hangs. I tried replacing it with a simple println and I got the same thing.

Okay, I just tried something else, and now I'm completely confused. I tried one more thing, where I had a few lines of code to just create a variable and toss it around a bit. I took out the showdialog and kept the println. I copied the new add-in to the ArcMap add-ins directory. Now when I click the button, I get the dialog box that an OLDER version of the add-in had, and it doesn't freeze anymore. It's running an older version of the add-in, but I have no idea where it's getting that version because the version I've got in there doesn't have that code anymore.

If this sounds familiar to anyone, please enlighten me!
0 Kudos
5 Replies
DuncanHornby
MVP Notable Contributor
Steve,

AddIns get cached. I have Windows VISTA and the location for my machine is here:

C:\Users\xxx\AppData\Local\ESRI\Desktop10.1\AssemblyCache

Before you try blitzing that (but only after you made a backup!) try using the AddIn manager in Arcmap to remove the AddIn.

Duncan
0 Kudos
SteveMarotta
New Contributor
Hi Duncan,

Thanks for the reply. I looked for the directory you indicated on my Win7 machine, and I couldn't find anything that looked like an ArcMap add-in cache anywhere, whether in Local or Roaming. I tried simply removing the add-in through the Add-In Manager, but it didn't seem to actually remove anything.

I've got it back to where it simply freezes when I try to click the button. I have no idea why it was working that one time, but I can't seem to replicate the results.

It's all rather frustrating. Because I can't seem to control where it's getting anything from or whether it's getting anything at all, I can't effectively debug the problem, and there's no debug information I can find that might explain why it's locking up ArcMap. I'd appreciate any and all additional insights you might be able to offer.
0 Kudos
SteveMarotta
New Contributor
Okay, so I did find the AssemblyCache directory after all, but I only see MapCenter and not my custom add-in. Removing the add-in and copying it fresh didn't seem to help either.
0 Kudos
DuncanHornby
MVP Notable Contributor
So in ArcMap when you use the AddIn manager, you can remove the folder and\or delete Addin? If you do that then restart ArcMap are you saying they are still showing up in the AddIn manager?

Also where are you compiling your addin too? You can see this in visual studio in the build output path in project properties > compile. If you have not set this then it will default to some location and I'm wondering each time you compile\debug it you are resetting ArcMap to point to it.
0 Kudos
SteveMarotta
New Contributor
I'm building the Add-In through Eclipse, using the Export link in the config.xml editor. I'm exporting it to a development output directory and then copying it to (home-dir)\Documents\ArcGIS\AddIns\Desktop10.0

And now, somehow, I've got it working. I took out the showDialog and put in a println and now it works. I'm not sure why it didn't work before. Maybe I hadn't copied it over correctly? So then I put in the logic that's supposed to be in there and it works great. No idea what was wrong. I fully expect it to stop working without warning one day.

Thank you for your help! I know more about the Add-In system than I did before, and for that I am grateful.
0 Kudos