Excel Addin Disappears from Ribbon Randomly

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

Excel Addin Disappears from Ribbon Randomly
We are having difficuly tracking down why one of our clients sees our excel addin disappear from the ribbon almost daily. 
Stan Morin




Posts: 14
Joined: 2012-09-17
Hi All,

Our team is running into a difficult to track issue with a few users where they experience our addin ribbon disappear at somewhat random times (usually in at the beginning of work when they spin up excel).

Heres a few details on the situation:
- The user is has Windows 10 Pro 10.0 2009, 64 bit, build 19044
- The user is has Excel 2016, 64 bit, v16.0
- When the user installs our addin, adxregistrator runs properly and sets loadbehavior to 3
- When the error happens and the ribbon is gone, we verified loadbehavior is set to 2
- The user is not launching excel as admin (something we found on the forum here)
- As seen in the code below in our ADX Loader Logs, the user is loading an excel file from a sharepoint drive


Add-in Express Loader Log File: 05/16/2023 08:53:10:202

Startup directory: C:UsersXXXXXXXAppDataLocalInterjectApp
Loader version: 10.1.4703.0
Operating System: Microsoft Windows 10 Professional (build 19044), 64-bit
Process Owner: Administrator
Command Line: "C:Program FilesMicrosoft Office
ootOffice16EXCEL.EXE" /cid XXXXXXXXX "https://XXXXX.sharepoint.com/personal/XXXXX/Documents/Microsoft%20Teams%20Chat%20Files/XXXXXXX.xlsx"
Run 'As Administrator': Yes
Process Elevated: Yes
Integrity Level: High
UAC (User Account Control): On


- The user also has no other Excel or COM addins enabled on their system
- After addin install, only 1 OPEN registry key entry exists. (previously was saw an error with addins disappearing related to multiple entries of OPEN pointing to both adxloader and adxloader64 due to a bug on our installer)
- our addin has its own tab and uses "AddinExpress.MSO.ADXRibbonTab"


Resources we found on the topic:
- cannot run excel as admin - https://www.add-in-express.com/forum/read.php?FID=5&TID=14948
- loadbehavior set to 2 after msi update - https://www.add-in-express.com/forum/read.php?FID=5&TID=15071
- addinspy may be able to troubleshoot excel ui issues - https://github.com/NetOfficeFw/AddInSpy
- similar issue it sounds like - https://www.add-in-express.com/forum/read.php?PAGEN_1=1&FID=5&TID=12426#nav_start


Troubleshooting we are trying:
- have user manually set loadbehavior to 3 = addin loads again
- reinstall our addin = works initially, but issue resurfaces
- have user enable Options->Advanced->"Show add-in user interface errors" = no response yet
- try to replicate issue and run AddinSpy to see any logs on our machines = cannot replicate yet
- continue reviewing logs to find anything strange - ongoing


Any help or ideas would be much appreciated!

Thanks!
Posted 24 May, 2023 16:47:48 Top
Andrei Smolin


Add-in Express team


Posts: 19122
Joined: 2006-05-11
Hello Stan,

Stan Morin writes:
Run 'As Administrator': Yes
Process Elevated: Yes
Integrity Level: High
UAC (User Account Control): On


This indicates Excel starting elevated. You should start Excel non-elevated.

Is it possible that the add-in produces an exception while the add-in module is being constructed?

Below is section "Restrictions applied to Add-in Express modules" from the Add-in Express manual (see the PDF file in the folder {Add-in Express}\Docs on your development PC). Also, check section Error handling in Office extensions.

You should be aware that by design, an instance of the module is created under the following circumstances:
?Â?Ð?? When the project is being built.
?Â?Ð?? When the Office extension is being registered or unregistered.
?Â?Ð?? When Office loads the extension.

The restrictions below are a direct result of these facts. To avoid issues, you should execute custom code in an event of the module, not in the constructor. This guarantees that your code is only executed while the add-in is loaded in the host Office application.

Adding custom code to the module's constructor is not recommended

When the module is created in the scenarios above, no Office-related objects, properties, methods, or events are available. Also, the Add-in Express related properties are not initialized yet. If the add-in code is not prepared for this, the add-in installer may fail. The simplest way to prevent this is to remove custom code from the constructor.

Correctly initializing class-level variables defined on module class

This restriction applies to complex-type variables only. Consider using an initializer of a complex-type variable declared on the class level of the add-in module. When an instance of the module is created for these purposes, to initialize such a variable, the .NET Framework loads the assembly containing the variable's type. If that assembly doesn't expect to be loaded in the scenario above, it fails (say, because of an improper context) and, consequently, the add-in installer may fail. Note that the issue occurs even if the initializer sets the variable to null (Nothing in VB.NET).


Regards from Poland (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 25 May, 2023 04:09:23 Top
Stan Morin




Posts: 14
Joined: 2012-09-17
Hi Andrei, thanks for the quick reply!

(1) I noticed that as well, but I checked with the client and they said they are not launching Excel "as admin" and we also checked their Excel.exe shortcut's advanced properties and its not set to launch "as admin".

So if this is the case what else could cause the excel process be launching as an elevated process?

(2) We also were curious about changes to our COM module initializer function causing an exception but reviewing that we didn't notice anything suspicious related to custom code. I will do another more thorough review of that method today though.


Thanks
Posted 25 May, 2023 11:12:53 Top
Andrei Smolin


Add-in Express team


Posts: 19122
Joined: 2006-05-11
Hello Stan,

Stan Morin writes:
So if this is the case what else could cause the excel process be launching as an elevated process?


While Excel is started, open the Details tab of the Task Manager window and check whether EXCEL.EXE is started using the user's Windows account. Also, re-check the shortcut and then check the EXCEL.EXE file itself: open its Properties and check Compatibility settings.

Regards from Poland (GMT+2),

Andrei Smolin
Add-in Express Team Leader
Posted 26 May, 2023 03:24:47 Top
Stan Morin




Posts: 14
Joined: 2012-09-17
Sorry for the delay (the forum would not let me post for a few days), thanks for the advice though! Next time I am on a troubleshooting call with that user I will try your suggestion and report back if I am able to learn anything.
Posted 01 Jun, 2023 11:44:19 Top