XL com addin Exception has been thrown by the target of an invocation

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

XL com addin Exception has been thrown by the target of an invocation
Exception has been thrown by the target of an invocation. Error code: 0x80131604 
Michael Benowitz




Posts: 32
Joined: 2017-02-03
Hello,

On a 2012 Windows Server with Excel 2010 I get the error Exception has been thrown by the target of an invocation. Error code: 0x80131604. I attached the log below. Any guidance is appreciated.

Thanks,

Mike B


Add-in Express Loader Log File: 07/31/2018 10:08:32:646

Startup directory: C:\Program Files (x86)\FUND E-Z Development Corporation\FUND E-Z 12 XL\
Loader version: 8.7.4430.0
Operating System: Microsoft Windows Server 2012 R2 Standard Edition (build 9600), 64-bit
Process Owner: Administrator
Command Line: "C:\Program Files\Microsoft Office\Office14\EXCEL.EXE"
Run 'As Administrator': Yes
Process Elevated: Yes
Integrity Level: High
UAC (User Account Control): On
------------------------------------------------------------------------
10:08:32:646 2136 9096 Start.
10:08:32:646 2136 9096 Creating a new instance of the add-in loader.
10:08:32:646 2136 9096 Loading mscoree.dll
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Loading the configuration from the system registry.
10:08:32:646 2136 9096 Getting the latest CLR version.
10:08:32:646 2136 9096 The latest CLR version is 'v4.0.30319'.
10:08:32:646 2136 9096 The configuration has been loaded successfully.
10:08:32:646 2136 9096 Runtime version: v4.0.30319.
10:08:32:646 2136 9096 Assembly name: FUNDEZ12.XL.
10:08:32:646 2136 9096 Class name: AddinModule.
10:08:32:646 2136 9096 Registry key: CLSID\{89DA943C-82E0-460C-AD9C-E450AABB088A}.
10:08:32:646 2136 9096 Attempting to create a new instance of the managed add-in class: CLR - v4.0.30319
10:08:32:646 2136 9096 Loading CLR: v4.0.30319.
10:08:32:646 2136 9096 Calling CLRCreateInstance method.
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Calling GetRuntime method.
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Checking if the hosting API of .NET Framework v4.0 beta is installed.
10:08:32:646 2136 9096 The hosting API is up to date.
10:08:32:646 2136 9096 Calling SetDefaultStartupFlags method.
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Calling GetInterface method for the CorRuntimeHost interface.
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Starting CLR...
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Getting the CLR version.
10:08:32:646 2136 9096 The CLR v4.0.30319 has been initialized successfully.
10:08:32:646 2136 9096 Creating a new domain setup.
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Getting the add-in directory.
10:08:32:646 2136 9096 Success. The directory is 'C:\Program Files (x86)\FUND E-Z Development Corporation\FUND E-Z 12 XL\'
10:08:32:646 2136 9096 The 'shadow copy' is enabled.
10:08:32:646 2136 9096 Creating a new application domain.
10:08:32:646 2136 9096 Success.
10:08:32:646 2136 9096 Creating an instance of the managed class. Assembly identity: 'FUNDEZ12.XL'
10:08:32:755 2136 9096 Exception has been thrown by the target of an invocation. Error code: 0x80131604
Posted 31 Jul, 2018 09:12:50 Top
Andrei Smolin


Add-in Express team


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

Thank you for providing the log file. It shows that an exception occurs when the loader creates an instance of your add-in module. Is it possible that you have some custom code in the constructor of the module? Or class-level initializers of complex type variables? These things should be moved to an event of the add-in module: AddinInitialize or OnRibbonBeforeCreate whatever occurs first; note that this depends on the application used and Office version and also on the way you start the Office application.

Does the issue persist if you start Excel non-elevated?


Andrei Smolin
Add-in Express Team Leader
Posted 31 Jul, 2018 09:58:07 Top
Michael Benowitz




Posts: 32
Joined: 2017-02-03
I reviewed my code and didn't see any code that would be firing in error. The issue is only on this server. The add-in runs fine on other pc's

Running non-elevated made no difference.

Thanks,

Mike Benowitz
Posted 01 Aug, 2018 11:02:06 Top
Michael Benowitz




Posts: 32
Joined: 2017-02-03
I setup a second server running 2106 server instead of 2012, but running office 10 also. It gets the same error and produces an almost identical log. Could the issue be specific to office 2010.
Posted 01 Aug, 2018 15:29:36 Top
Andrei Smolin


Add-in Express team


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

I doubt it. Please send me your AddinModule.cs and AddinModule.Designer.cs (AddinModule.vb and AddinModule.Designer.vb) files to the support email address; find it in {Add-in Express installation folder}\readme.txt. Please make sure your email contains a link to this topic.


Andrei Smolin
Add-in Express Team Leader
Posted 02 Aug, 2018 07:07:16 Top
Andrei Smolin


Add-in Express team


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

I've found a number of class-level declarations following this pattern:

Dim Seg0List As New {some object declared in another assembly}

You should replace such a declaration with the following one:

Dim Seg0List As {some object declared in another assembly}

That is, I removed the New. To get that object this object properly initialized, initialize it in the AddinInitialize or OnRibbonBeforeCreate event; whatever occurs first. Which of them is raised first depends on the application used and Office version and also on the way you start the Office application.

I've sent you the supposedly full list of such declarations by email.


Andrei Smolin
Add-in Express Team Leader
Posted 02 Aug, 2018 10:48:57 Top
Michael Benowitz




Posts: 32
Joined: 2017-02-03
We're getting close.

Making the suggested changes and changing my add-in to compile as any cpu allows me to manually register my add-in. My add-in works correctly, but only if I activate in within excel on the com add in screen. If I close excel I need to manfully register the add-in next time I launch excel.

This is using office 2010 on a 64bit windows 2016 server.

I don't have this issue with office 2016 32 bit.

Mike
Posted 06 Aug, 2018 09:27:21 Top
Andrei Smolin


Add-in Express team


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

Close Excel and unregister your add-in. If the add-in is installed, uninstall it as well. Check that the add-in is absent in the Excel UI. Register the add-in anew and restart Excel. Does it work? If the issue persists, delete adxloader.log, close Excel, find the add-in disabled, check if adxloader.log is created: if it is created, let me look in it.


Andrei Smolin
Add-in Express Team Leader
Posted 07 Aug, 2018 03:10:57 Top
Michael Benowitz




Posts: 32
Joined: 2017-02-03
Manually Removing the add in from excel, then uninstalling reinstalling did the trick. Thanks for your help.

Mike
Posted 07 Aug, 2018 08:02:59 Top
Andrei Smolin


Add-in Express team


Posts: 18821
Joined: 2006-05-11
You are welcome!


Andrei Smolin
Add-in Express Team Leader
Posted 07 Aug, 2018 08:43:04 Top