ArcMap crashes with add-in, but not when started from Visual Studio 2012

Discussion created by golden_jubilee on May 12, 2014
Latest reply on May 12, 2014 by rlwatson
I am building an add-in for a while. It is open source and the code is here:

The problem:
ArcMap (latest version) crashes on start up when the add-in is installed.
According to the log file sometimes when the extensions are initialized, which makes sense.

The interesting part is that it works very well when I start it via Visual Studio 2012. At some point in time (2 months ago?) it also worked without Visual Studio 2012, but I developed and never tested it without and therefore I have no idea what change causes this behavior.

Another interesting observation is that I can install the add-in for the first time and use a small part of the functionality (every other will crash ArcMap) without a problem. When I restart ArcMap, ArcMap will crash again.

The last observation is that I can start it from Visual Studio 2013. In lets say 1 out of 10 times Visual Studio 2013 will crash and ArcMap starts or ArcMap.exe cannot be started and Visual Studio 2013 does not crash.

I have two external dlls included and target version is 4.5 (4.0 will also crash, I tried it).

The only option I see is to remove features and try until I find the evil method call or whatever.

Do I have a chace to debug the ArcMap extension initialization?
It would be beneficial to know what ArcMap does with add-ins on start up, e.g. is the startup method of my extension called? What checks are performed?