A Runtime error occurred during the loading on the COM Add-in

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

A Runtime error occurred during the loading on the COM Add-in
 
Greg Donaldson




Posts: 7
Joined: 2015-04-14
A client is successfully installing our Add-in but it goes to disabled and on the Word Comm Add-in screen gets the following error "A Runtime error occurred during the loading on the COM Add-in" for the dll adxloader.dll.

They are using Windows 8 and Word 2007. Their log file is:

Startup directory: C:\Users\XXXX\AppData\Local\SnappyStamp\
Loader version: 7.5.4072.0
Operating System: Microsoft (build 9200), 64-bit
Process Owner: Administrator
Command Line: "C:\Program Files (x86)\Microsoft Office\Office12\WINWORD.EXE"
Run 'As Administrator': No
Process Elevated: No
Integrity Level: Medium
UAC (User Account Control): On
------------------------------------------------------------------------
08:53:57:938 2580 6096 Start.
08:53:57:938 2580 6096 Reading the registry key 'HKEY_CLASSES_ROOT\CLSID\{E8CF7ED9-F850-4417-8CE0-45D962369308}'
08:53:57:938 2580 6096 Success. The registry key 'HKEY_CLASSES_ROOT\CLSID\{E8CF7ED9-F850-4417-8CE0-45D962369308}' is closed.
08:53:57:938 2580 6096 Converting the '{4BA250A6-8BCA-46A6-982A-F340081187C3}' CLSID from string.
08:53:57:938 2580 6096 Success.
08:53:57:938 2580 6096 Attempting to get the class object by the '{4BA250A6-8BCA-46A6-982A-F340081187C3}' CLSID.
08:53:57:938 2580 6096 Success.
08:53:57:938 2580 6096 Creating a new instance of the add-in loader.
08:53:57:938 2580 6096 Loading mscoree.dll
08:53:57:938 2580 6096 Success.
08:53:57:938 2580 6096 Loading the configuration from the system registry.
08:53:57:938 2580 6096 Getting the latest CLR version.
08:53:57:938 2580 6096 The latest CLR version is 'v4.0.30319'.
08:53:57:938 2580 6096 The configuration has been loaded successfully.
08:53:57:938 2580 6096 Runtime version: v2.0.50727.
08:53:57:938 2580 6096 Assembly name: SnappyStamp, PublicKeyToken=203C89B140F83D13.
08:53:57:938 2580 6096 Class name: SnappyStampAddin.AddinModule.
08:53:57:938 2580 6096 Registry key: CLSID\{E8CF7ED9-F850-4417-8CE0-45D962369308}.
08:53:57:938 2580 6096 Attempting to create a new instance of the managed add-in class: CLR - v2.0.50727
08:53:57:938 2580 6096 Loading CLR: v2.0.50727.
08:53:57:938 2580 6096 Calling CLRCreateInstance method.
08:53:57:938 2580 6096 Success.
08:53:57:938 2580 6096 Calling GetRuntime method.
08:53:57:938 2580 6096 Success.
08:53:57:938 2580 6096 Checking if the hosting API of .NET Framework v4.0 beta is installed.
08:53:57:954 2580 6096 The hosting API is up to date.
08:53:57:954 2580 6096 Calling GetInterface method for the CorRuntimeHost interface.
08:53:57:954 2580 6096 Success.
08:53:57:954 2580 6096 Starting CLR...
08:53:57:954 2580 6096 Success.
08:53:57:954 2580 6096 Getting the CLR version.
08:53:57:954 2580 6096 The CLR v2.0.50727 has been initialized successfully.
08:53:57:954 2580 6096 Creating a new domain setup.
08:53:57:954 2580 6096 Success.
08:53:57:954 2580 6096 Getting the add-in directory.
08:53:57:954 2580 6096 Success. The directory is 'C:\Users\XXXX\AppData\Local\SnappyStamp\'
08:53:57:954 2580 6096 The 'shadow copy' is disabled.
08:53:57:954 2580 6096 Creating a new application domain.
08:53:57:970 2580 6096 Error code: 0x80131534

How can I identify what to investigate here?

Thanks

Greg
Posted 14 Apr, 2015 07:57:59 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Hello Greg,

The HRESULT stands for COR_E_TYPEINITIALIZATION, which stands for TypeInitializationException. It may relate to some problem in the constructor of the add-in module. I assume it installs correctly on other machines, so maybe you use something that customer doesn't have: some DLL, wrong date/time format, invalid config element, etc.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Apr, 2015 09:12:44 Top
Greg Donaldson




Posts: 7
Joined: 2015-04-14
I understand the error and it does install correctly on other machines but I need to know how I can investigate in more detail. I don't have access to the clients machine and the error is raised within adxloader.dll.

Please any suggestions?
Posted 14 Apr, 2015 09:46:07 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
Greg,

The error occurs in the code of your add-in, not in adxloader.dll. You can add a number of debug messages to your code; use System.Diagnostics.Debug.WriteLine(). You collect the messages at run time using DebugView (see http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx).


Andrei Smolin
Add-in Express Team Leader
Posted 14 Apr, 2015 10:03:45 Top
Greg Donaldson




Posts: 7
Joined: 2015-04-14
Thanks for the quick responses.

If it is a type initialisation error then it is highly possible that no code is actually executed. e.g. A static property not initialising. Isn't this correct?
Posted 14 Apr, 2015 10:31:49 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
I think there are many scenarios, not just a static property not initializing.

If you have custom code in the constructor of the add-in module, we recommend moving it to an event handler e.g. AddinInitialize or OnRibbonBeforeCreate. The same applies to class-level initializers.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Apr, 2015 10:38:45 Top
Greg Donaldson




Posts: 7
Joined: 2015-04-14
I had found that information last week and removed all code from the AddinModule initialisation but it did not resolve the issue. I do have some static properties in the AddinModule class that could be the problem so I will change them.

Should I just focus on the AddinModule or look at all classes in my Addin?
Posted 14 Apr, 2015 11:00:45 Top
Andrei Smolin


Add-in Express team


Posts: 18793
Joined: 2006-05-11
If you create and/or initialize some classes in class-level initializers, then some other classes may be involved. Note that even setting null/nothing to a variable of the type declared somewhere, will load the corresponding assembly and this may end in the exception.


Andrei Smolin
Add-in Express Team Leader
Posted 14 Apr, 2015 11:05:00 Top