Add-in Load Error

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

Add-in Load Error
Add-In Fails To Load From COM-Addin / Developer Tab  
Michael Thrift




Posts: 41
Joined: 2015-06-09
Below is the Call Stack from the AddinModule_OnError event. The Add-In loads just fine when opening a new instance of Excel, or testing the Add-in in debug mode.

However, we also have several Document Level Customization's that we manage, and when we debug them, Excel loads them first, before the Add-in. (Only scenario where this happens).

Because the Document Level Customization does rely on the Add-in to function correctly, we test to see if the Add-in is loaded. If not, we load it.

When we try to load the add-in this way, we get the below error. This is done in code, however the same error occurs if you de-activate the Add-in, and then try to load it again from the COM-Addin's form on the Developer tab.

Finally, I've stepped through every possible line of code, including code in the Designer to see where the error is happening. It never jumps to the OnError event. It just runs through everything, and then fires the Error Event last.

Assembly Full Name: AddinExpress.MSO.2005, Version=7.7.4087.2005, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version: 7.7.4087.2005

Exception Source: AddinExpress.MSO.2005
Exception Type: System.NullReferenceException
Exception Message: Object reference not set to an instance of an object.
Exception Target Site: GetAttributes

---- Stack Trace ----
AddinExpress.MSO.ADXRibbonButton.GetAttributes()
AddinExpress.MSO.2005.dll: N 0307 (0x133) IL
AddinExpress.MSO.ADXRibbonCustomControl.AddinExpress.MSO.IADXRibbonComponent.get_Attributes()
AddinExpress.MSO.2005.dll: N 0000 (0x0) IL
AddinExpress.MSO.ADXAddinModule.ProcessChildren(xmlData As XmlTextWriter, ribbonElement As IADXRibbonComponent, ribbonID As String, uniqueId As Int32, ribbonControl As IRibbonControl)
AddinExpress.MSO.2005.dll: N 0088 (0x58) IL
AddinExpress.MSO.ADXAddinModule.ProcessChildren(xmlData As XmlTextWriter, ribbonElement As IADXRibbonComponent, ribbonID As String, uniqueId As Int32, ribbonControl As IRibbonControl)
AddinExpress.MSO.2005.dll: N 0359 (0x167) IL
AddinExpress.MSO.ADXAddinModule.ProcessChildren(xmlData As XmlTextWriter, ribbonElement As IADXRibbonComponent, ribbonID As String, uniqueId As Int32, ribbonControl As IRibbonControl)
AddinExpress.MSO.2005.dll: N 0359 (0x167) IL
AddinExpress.MSO.ADXAddinModule.ProcessChildren(xmlData As XmlTextWriter, ribbonElement As IADXRibbonComponent, ribbonID As String, uniqueId As Int32, ribbonControl As IRibbonControl)
AddinExpress.MSO.2005.dll: N 0359 (0x167) IL
AddinExpress.MSO.ADXAddinModule.ProcessChildren(xmlData As XmlTextWriter, ribbonElement As IADXRibbonComponent, ribbonID As String, uniqueId As Int32, ribbonControl As IRibbonControl)
AddinExpress.MSO.2005.dll: N 0359 (0x167) IL
AddinExpress.MSO.ADXAddinModule.AddinExpress.MSO.IRibbonExtensibility.GetCustomUI(RibbonID As String)
AddinExpress.MSO.2005.dll: N 1629 (0x65D) IL [/CODE]
Posted 14 Sep, 2015 13:58:24 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Hello Michael,

Could you please send us the InitializeComponent method which is called from the constructor of your add-in module? I assume you don't modify the set of Ribbon components in the OnRibbonBeforeCreate event of the add-in module and you don't modify the Ribbon XML in the OnRibbonBeforeLoad event of the add-in module. If the assumption is wrong, please also send me the code of these event handlers. You can send your email to the support email address; you can find it in {Add-in Express installation folder}\readme.txt. Please make sure your email contains a link to this topic.

In what Excel version do you experience this?


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2015 06:39:30 Top
Michael Thrift




Posts: 41
Joined: 2015-06-09
I've sent the InitializeComponent method. We do not execute any code in the OnRibbonBeforeCreate or OnRibbonBeforeLoad events. However, as I mentioned in my email, we do add ADXRibbonButton objects in the AddinModule_AddinInitialize event. With our VSTO version of this Add-In, this code was executed in the Constructor of the Ribbon. We moved it to the AddinInitialize event per comments in the Constructor of the AddinModule.

We are running Excel 2010.
Posted 15 Sep, 2015 09:00:51 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Michael,

I haven't received the code. Still, adding ADXRibbonButton objects in the AddinModule_AddinInitialize event is too late. You need to do this in the OnRibbonBeforeCreate event.

If your add-in project doesn't contain sensitive code, you can send it to me. I'll test it here.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2015 09:08:41 Top
Michael Thrift




Posts: 41
Joined: 2015-06-09
Andrei,

I verified the email was sent. Hopefully you get it soon. I commented out the code where I add ADXRibbonButton objects in the AddinInitialize even and it solved the problem. The Add-In did not error when loading from the COM-Addin Dialog Launcher.

The buttons did not show up regardless, so that should have been my first clue. I'd be interested to know why it only throws an error when loading from an active instance of Excel as opposed to loading the Add-in during the startup of Excel.

Correct me if I am wrong, but VSTO has two seperate constructors for the Add-in and the Ribbon. This is why the code worked in VSTO because we were adding the buttons to the constructor of the Ribbon?

Thanks for looking into this! If you don't get the email, let me know.

Thanks!
Posted 15 Sep, 2015 09:23:42 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Michael,

I've received the email. Thank you.

I've created a test project based on the InitializeComponent method that you sent, see http://temp.add-in-express.com/support/MyAddin109-RibbonUiTest.zip. It generates the following error message at startup:

===
"FilePrintMenu" is not a repurposableCommand. Only "button", "toggleButton" and "checkBox" can have onAction callbacks in <commands>
===

To get this error message, you need to select option "Show add-in user interface errors"; check out section "Get Informed about Errors in Ribbon markup", see the PDF file in the folder {Add-in Express}\Docs on your development PC.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2015 10:04:48 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
I'm sorry, I've missed this part:

Michael Thrift writes:
Correct me if I am wrong, but VSTO has two seperate constructors for the Add-in and the Ribbon. This is why the code worked in VSTO because we were adding the buttons to the constructor of the Ribbon?


It looks like, yes. this was the case.

A COM add-in supports two COM interfaces: 1) IDTExtensibility2, in Add-in Express, it is represented by these events: AddinInitialize, Addinstartupcomplete, AddinBeginShutdown, AddinFinalize, and 2) IRibbonExtensibility, in Add-in Express, you get OnRibbonBeforeCreate, OnRibbonBeforeLoad and OnRibbonLoaded events. You create the Ribbon UI of your add-in in the OnRibbonBeforeCreate or OnRibbonBeforeLoad events.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Sep, 2015 10:31:01 Top