MsProject Addin exception at Add-in Startup only when debugging

Add-in Express™ Support Service
That's what is more important than anything else

MsProject Addin exception at Add-in Startup only when debugging
 
Cameron Hynes




Posts: 17
Joined: 2016-07-12
Hiya Addin Express team,

I'm experiencing an exception during start-up which is setting my LoadBehavior=2, but this is only happening during Debugging of my Addin.

I've searched around the forums and followed all the advice I could find, but I'm still unable to debug my Addin.

To clarify, the Startup Exception only occurs during debugging. If I install my Addin and open MsProject then the Addin works fine and doesn't encounter any Startup Exceptions.

Things I've tried:
Uninstall Addin
Deregister Addin
Register Addin -> Does Addin appear in UI list of MsProject Addins? -> No, does not appear after registering

My guess is my registry is messed up, but I don't know that for sure.

Kind regards
Cameron
Posted 22 May, 2017 00:08:07 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Cameron,

Do you get this exception before any class-level initializer gets executed?


Andrei Smolin
Add-in Express Team Leader
Posted 22 May, 2017 05:31:44 Top
Cameron Hynes




Posts: 17
Joined: 2016-07-12
Hiya Andrei,

Sorry that I can't answer your question directly, to the best of my understanding here's what we're doing:

We have a module: public partial class AddinModule : AddinExpress.MSO.ADXAddinModule

We have a breakpoint in the constructor of this module, which is never hit during debugging:
public AddinModule()
{
Application.EnableVisualStyles();
InitializeComponent();
// Please add any initialization code to the AddinInitialize event handler
}
Posted 22 May, 2017 16:40:15 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Cameron,

That is, the add-in doesn't load. What MSProject version is started when you press F5 in the Visual Studio IDE? Is loading in that version allowed by the minOfficeVersionSupported attribute in adxloader.dll.manifest (see the Loader folder of your add-in project)?


Andrei Smolin
Add-in Express Team Leader
Posted 23 May, 2017 06:29:42 Top
Cameron Hynes




Posts: 17
Joined: 2016-07-12
Hiya Andrei,

I checked the Office versions:
minOfficeVersionSupported="12"
Office version installed & configured to run when debugging: Office15

I suspect the Addin is attempting to load, because I'm watching the registry key: "LoadBehavior=3" becomes "LoadBehavior=2" when debugging has started.

I don't understand why I can't hit the debug point in the constructor code I posted earlier, maybe the underlying problem is that I can't debug the Addin and hence can't go fix whatever's causing the Exception.


I should mention that I've this Addin has been debugging correctly for a year, and this week while developing a new minor feature for the Addin, it began throwing exceptions and changing LoadBehavior=2 when starting debugging.

This makes me think the Addin is attempting to start but maybe I have something configured incorrectly. The minor feature I included was a text label in the Ribbon UI that shows the Assembly version of the Addin.

I don't think the text label change I made recently is the problem because the release version of the same Addin version is installing and working correctly in MsProject 2013.

Thanks for your help Andrei, we're pretty stuck without being able to debug.
Posted 23 May, 2017 16:41:59 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Cameron,

Check if section "Breakpoints are not hit when debugging" at https://www.add-in-express.com/docs/net-deploying-debugging-tips.php#breakpoints applies.

Cameron Hynes writes:
We have a breakpoint in the constructor of this module, which is never hit during debugging:


If there is a class-level initializer defined in the add-in module, try to set a breakpoint on it.


Andrei Smolin
Add-in Express Team Leader
Posted 24 May, 2017 04:30:19 Top
Cameron Hynes




Posts: 17
Joined: 2016-07-12
Hiya Andrei,

I've checked the .Net version that's used for debugging in the link you provided, there were no config files for any Office applications.

I have new information to help solve the problem:

We've managed to hit a breakpoint on two other development machines in the office, so the problem of not hitting breakpoints is specific to my machine.

On my machine when I run the 'Addin Express > Register' command on the Addin project, it doesn't seem to work correctly but I don't know enough to be sure that it's not working. I've been monitoring the Adxregistrator.log file when I select the 'Register' option and I notice the log doesn't change, making me think the registration isn't working.

Kind regards
Cameron
Posted 24 May, 2017 20:51:46 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Cameron,

Cameron Hynes writes:
I've been monitoring the Adxregistrator.log file when I select the 'Register' option and I notice the log doesn't change


That file doesn't change because adxregistrator.exe isn't involved when you register your add-in using the corresponding option in the Visual Studio IDE.

Have you ever changed the RegisterForAllUsers property of the add-in module? Is it possible that you debug e.g. a per-user add-in while a per-machine version is still registered?

Is it possible that you have the add-in installed? If so uninstall it, unregister the project, start the host application, check if the add-in is still available in the host's UI, close the host, register the project and try debugging it.


Andrei Smolin
Add-in Express Team Leader
Posted 25 May, 2017 04:43:12 Top
Cameron Hynes




Posts: 17
Joined: 2016-07-12
Hiya Andrei,

Sorry for my delayed response, to answer your questions:

Have you ever changed the RegisterForAllUsers property of the add-in module? Is it possible that you debug e.g. a per-user add-in while a per-machine version is still registered?


It's quite likely that I changed the RegisterForAllUsers property, and I've also installed 32 and 64 versions of MsProject to ensure the Addin works in both versions.

Is it possible that you have the add-in installed? If so uninstall it, unregister the project, start the host application, check if the add-in is still available in the host's UI, close the host, register the project and try debugging it.


Indeed the Addin is installed, so I've uninstalled, unregistered, checked MsProject is not showing the Addin, registered the project and tried debugging. The result was that the breakpoints aren't hit, and the Addin isn't listed in MsProject's Addin options.

We'll be reformatting my PC in the near future and have continued development of the Addin on another PC which hits breakpoints while debugging, so no need to dig any further in this case. Thanks for your help.

Kind regards
Cameron
Posted 29 May, 2017 20:16:27 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
Hello Cameron,

Thank you for letting me know.


Andrei Smolin
Add-in Express Team Leader
Posted 30 May, 2017 02:15:34 Top