Strange OnStartupComplete error in Excel

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

Strange OnStartupComplete error in Excel
 
Pino Carafa




Posts: 162
Joined: 2016-09-28
Recently a strange error message has started popping up. It doesn't appear to interfere with the functionality of our Add-in. The user can just OK the message away, and after that all our functionality still appears to be working just fine. But obviously we cannot have an error message popping up...

This is the error itself:


Detailed technical information follows: 
---
(Inner Exception)
Date and Time:         09/12/2020 09:09:23
Machine Name:          SKC9
IP Address:            fe80::8426:fb2f:4d88:34bd%17
Current User:          SKC9steph

 

Application Domain:    C:Program Files (x86)Keyhouse Computing LtdKeyhouse Case Documents integration for Office 2010 or later
Assembly Codebase:     file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
Assembly Full Name:    mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Assembly Version:      4.0.0.0

 

Exception Source:      mscorlib
Exception Type:        System.Security.SecurityException
Exception Message:     Requested registry access is not allowed.
Exception Target Site: ThrowSecurityException

 

---- Stack Trace ----
   System.ThrowHelper.ThrowSecurityException(resource As ExceptionResource)
       mscorlib.dll: N 0016 (0x10) IL 
   Microsoft.Win32.RegistryKey.OpenSubKey(name As String, writable As Boolean)
       mscorlib.dll: N 0000 (0x0) IL 
   AddinExpress.Projects.Common.ADXRegistry.OpenKey(name As String, writable As Boolean)
       mscorlib.dll: N 0192 (0xC0) IL 

 

 

(Outer Exception)
Date and Time:         09/12/2020 09:09:23
Machine Name:          SKC9
IP Address:            fe80::8426:fb2f:4d88:34bd%17
Current User:          SKC9steph

 

Application Domain:    C:Program Files (x86)Keyhouse Computing LtdKeyhouse Case Documents integration for Office 2010 or later
Assembly Codebase:     file:///C:/Program Files (x86)/Keyhouse Computing Ltd/Keyhouse Case Documents integration for Office 2010 or later/AddinExpress.MSO.2005.DLL
Assembly Full Name:    AddinExpress.MSO.2005, Version=9.4.4644.0, Culture=neutral, PublicKeyToken=4416dd98f0861965
Assembly Version:      9.4.4644.0

 

Exception Source:      AddinExpress.MSO.2005
Exception Type:        System.Exception
Exception Message:     OpenKey failed.
Exception Target Site: OpenKey

 

---- Stack Trace ----
   AddinExpress.Projects.Common.ADXRegistry.OpenKey(name As String, writable As Boolean)
       AddinExpress.MSO.2005.DLL: N 0292 (0x124) IL 
   AddinExpress.MSO.ADXAddinModule.AddinExpress.MSO.IDTExtensibility2.OnStartupComplete(custom As Array&)
       AddinExpress.MSO.2005.DLL: N 1434 (0x59A) IL 


A couple of odd things about this...

1. The error implicates AddinExpress.MSO.ADXAddinModule.AddinExpress.MSO.IDTExtensibility2.OnStartupComplete but sometimes it can be quite a while before the error message is shown to the user.
2. When the error occurs it seems that something is holding a handle on Excel. When you then close Excel you can still see it in the Task Manager and you have to kill it from there.

As a result I'm not sure that it gets the chance to write the really relevant information to the Log file, but just in case, here is the content of adxloader.log


Add-in Express Loader Log File: 12/09/2020 09:09:01:580

 

Startup directory: C:Program Files (x86)Keyhouse Computing LtdKeyhouse Case Documents integration for Office 2010 or later
Loader version: 9.4.4644.0
Operating System: Microsoft Windows 10 Professional (build 18363), 64-bit
Process Owner: Administrator
Command Line: "C:Program Files (x86)Microsoft Office
ootOffice16EXCEL.EXE" 
Run 'As Administrator': No
Process Elevated: No
Integrity Level: Medium
UAC (User Account Control): On
------------------------------------------------------------------------
09:09:01:581 4504 21744 Start.
09:09:01:582 4504 21744 The minimum supported Office version is 14
09:09:01:582 4504 21744 The host's version is 16.0.13328.20356
09:09:01:582 4504 21744 Creating a new instance of the add-in loader.
09:09:01:582 4504 21744 Loading mscoree.dll
09:09:01:582 4504 21744 INFO: Assembly codebase - C:Program Files (x86)Keyhouse Computing LtdKeyhouse Case Documents integration for Office 2010 or laterKHOfficeAddin.dll.
09:09:01:582 4504 21744 INFO: Assembly version - 5.8.1.1712.
09:09:01:583 4504 21744 Success.
09:09:01:583 4504 21744 Loading the configuration from the system registry.
09:09:01:583 4504 21744 Getting the latest CLR version.
09:09:01:584 4504 21744 The latest CLR version is 'v4.0.30319'.
09:09:01:584 4504 21744 The configuration has been loaded successfully.
09:09:01:584 4504 21744     Runtime version: v4.0.30319.
09:09:01:584 4504 21744     Assembly name: KHOfficeAddin, PublicKeyToken=FA1302E03B9C7607.
09:09:01:584 4504 21744     Class name: KHOfficeAddin.AddinModule.
09:09:01:584 4504 21744     Registry key: CLSID{091DBB8B-54FB-458D-A6CF-34D5B57863E3}.
09:09:01:584 4504 21744 Attempting to create a new instance of the managed add-in class: CLR - v4.0.30319
09:09:01:584 4504 21744 Loading CLR: v4.0.30319.
09:09:01:584 4504 21744 Calling CLRCreateInstance method.
09:09:01:584 4504 21744 Success.
09:09:01:584 4504 21744 Calling GetRuntime method.
09:09:01:584 4504 21744 Success.
09:09:01:584 4504 21744 Checking if the hosting API of .NET Framework v4.0 beta is installed.
09:09:01:590 4504 21744 The hosting API is up to date.
09:09:01:590 4504 21744 Calling SetDefaultStartupFlags method.
09:09:01:590 4504 21744 Success.
09:09:01:590 4504 21744 Calling GetInterface method for the CorRuntimeHost interface.
09:09:01:590 4504 21744 Success.
09:09:01:590 4504 21744 Starting CLR...
09:09:01:590 4504 21744 Success.
09:09:01:590 4504 21744 Getting the CLR version.
09:09:01:590 4504 21744 The CLR v4.0.30319 has been initialized successfully.
09:09:01:590 4504 21744 Creating a new domain setup.
09:09:01:591 4504 21744 Success.
09:09:01:591 4504 21744 Getting the add-in directory.
09:09:01:591 4504 21744 Success. The directory is 'C:Program Files (x86)Keyhouse Computing LtdKeyhouse Case Documents integration for Office 2010 or later'
09:09:01:592 4504 21744 The 'shadow copy' is disabled.
09:09:01:592 4504 21744 Creating a new application domain.
09:09:01:594 4504 21744 Success.
09:09:01:594 4504 21744 Creating an instance of the managed class. Assembly identity: 'KHOfficeAddin, PublicKeyToken=FA1302E03B9C7607'
09:09:01:693 4504 21744 Success.
09:09:01:693 4504 21744 Unwrapping the managed class.
09:09:01:709 4504 21744 Success.
09:09:01:709 4504 21744 Querying the add-in extensibility.
09:09:01:709 4504 21744 Success.
09:09:01:709 4504 21744 Querying the custom task panes.
09:09:01:709 4504 21744 Success.
09:09:01:709 4504 21744 Querying the ribbon extensibility.
09:09:01:709 4504 21744 Success.
09:09:01:709 4504 21744 Querying the form regions.
09:09:01:709 4504 21744 Success.
09:09:01:709 4504 21744 Querying the encryption provider.
09:09:01:710 4504 21744 The 'EncryptionProvider' interface is not supported.
09:09:01:710 4504 21744 Getting the dispid of the 'Dispose' method.
09:09:01:711 4504 21744 Success.
09:09:01:711 4504 21744 Getting the dispid of the 'InitializeLoaderService' method.
09:09:01:711 4504 21744 Success.
09:09:01:711 4504 21744 Invoking the 'InitializeLoaderService' method.
09:09:01:711 4504 21744 Success.
09:09:01:711 4504 21744 The instance of the managed add-in class has been created successfully.
Posted 09 Dec, 2020 04:31:31 Top
Andrei Smolin


Add-in Express team


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

I'm sorry, we would need more time to check the code and consider possibilities. Could you please wait for a day or two?


Andrei Smolin
Add-in Express Team Leader
Posted 10 Dec, 2020 05:41:08 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
We'll be happy to wait. Thanks for the reply Andrei.
Posted 10 Dec, 2020 05:56:17 Top
Andrei Smolin


Add-in Express team


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

When handling IDTExtensibility2.OnStartupComplete, Add-in Express handles these registry keys:

- Read/write; HKCU\Software\Microsoft\Office\{host application}\Addins\{your add-in's ProgId}.
- Read; HKCU\Software\Microsoft\Office\{version}\Common.

I'd check whether the user is able to access these keys and talk to an admin if the user is unable to access them.

Pino Carafa writes:
sometimes it can be quite a while before the error message is shown to the user


We don't have an explanation to this delay.

Pino Carafa writes:
When the error occurs it seems that something is holding a handle on Excel


We've noted this.


Andrei Smolin
Add-in Express Team Leader
Posted 11 Dec, 2020 02:06:45 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
Hello Andrei,

Thanks for the feedback.

With regard to the Registry access I am wondering whether there could be something like an Antivirus getting in the way? I don't think the user is MEANT to have no access to those keys in the registry; this would be our CEO/CTO and he has admin rights to his own PC, but an Antivirus could conceivably throw a spanner in the works there.

With regard to the error message would it be possible for Add-in Express to catch the error and raise an event so that we can show a more user friendly message to the user?
Posted 11 Dec, 2020 11:00:37 Top
Andrei Smolin


Add-in Express team


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

Pino Carafa writes:
With regard to the Registry access I am wondering whether there could be something like an Antivirus getting in the way?


I simply don't know.

Pino Carafa writes:
I don't think the user is MEANT to have no access to those keys in the registry


Still, this happens sometimes. We see such an issue every couple of years.

Maybe, the user's profile is stored on the LAN and in some way this relates to the issue.

I assume this isn't an Office from Microsoft Store version; see https://www.add-in-express.com/creating-addins-blog/2019/02/27/office-from-store-issues/.

Do you have a log? Does it provide extra details? If you prefer, you can send such details to our support email address.

Pino Carafa writes:
With regard to the error message would it be possible for Add-in Express to catch the error and raise an event so that we can show a more user friendly message to the user?


We'll consider doing this.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Dec, 2020 04:08:36 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
Hello Andrei,

I think the user is on Office 365 on Windows 10 - there is a log in the original post with the following detail:

09:09:01:581 4504 21744 Start.
09:09:01:582 4504 21744 The minimum supported Office version is 14
09:09:01:582 4504 21744 The host's version is 16.0.13328.20356

As mentioned in the original post, when the error occurs it seems that Excel cannot be unloaded as it remains in the Task Manager after "x"ing out. The log file output in the original post is all we could get after killing Excel.exe from the Task Manager :(
Posted 14 Dec, 2020 04:46:45 Top
Pino Carafa




Posts: 162
Joined: 2016-09-28
Thankfully this is not an Office from Microsoft Store version. Thanks for the heads up on that one. I'll make sure we instruct our clients to avoid that one!

The user profile is not stored on the LAN
Posted 14 Dec, 2020 06:43:52 Top