Replacing mscoree loader with adxloader on existing add-in -- registering but not loading

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

Replacing mscoree loader with adxloader on existing add-in -- registering but not loading
 
rberry51




Posts: 3
Joined: 2021-07-28
Hello,

I'm working with an Excel automation add-in (actually, it's an assembly that has both a VSTO/COM add-in as well as an Excel Add-in). We're working to have a code-signed loader for our add-in; and have turned to Add-In Express to fill the void. I am sub classing the AddInModule class and have determined how to use adxpatch.exe to generate my manifest with our code signing cert. This all works -- regsvr32 registers the add-in; but it never loads when running via the ADX loader. The log file as an interesting node highlighting it could not find Dispose (I believe) but we indeed have a dispose where we in-turn call the ADX dispose. I'm not sure if this is a red herring or the cause of while it's failing to load in Excel. Hoping for some advice on things to look at or try. Thanks in advance!

public class XFFunctions : AddinExpress.MSO.ADXAddinModule

Log file:

Loader version: 9.5.4661.0
Operating System: Microsoft Windows 10 Professional (build 19043), 64-bit
Process Owner: Administrator
Command Line: "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE"
Run 'As Administrator': No
Process Elevated: No
Integrity Level: Medium
UAC (User Account Control): On
------------------------------------------------------------------------
23:43:30:101 4544 30288 Start.
23:43:30:101 4544 30288 The minimum supported Office version is 14
23:43:30:102 4544 30288 The host's version is 16.0.14228.20204
23:43:30:102 4544 30288 Creating a new instance of the add-in loader.
23:43:30:102 4544 30288 Loading mscoree.dll
23:43:30:102 4544 30288 INFO: Assembly codebase - C:\XF\Source\Client\Windows\OneStreamExcelAddIn\bin\Debug\OneStreamExcelAddIn.dll.
23:43:30:106 4544 30288 INFO: Assembly version - 6.5.0.12623.
23:43:30:106 4544 30288 Success.
23:43:30:106 4544 30288 Loading the configuration from the system registry.
23:43:30:106 4544 30288 Getting the latest CLR version.
23:43:30:107 4544 30288 The latest CLR version is 'v4.0.30319'.
23:43:30:107 4544 30288 The configuration has been loaded successfully.
23:43:30:107 4544 30288 Runtime version: v4.0.30319.
23:43:30:107 4544 30288 Assembly name: OneStreamExcelAddIn.
23:43:30:107 4544 30288 Class name: OneStreamExcelAddIn.XFFunctions.
23:43:30:107 4544 30288 Registry key: CLSID\{43A52067-4882-4F55-8659-A30E8BE4C415}.
23:43:30:107 4544 30288 Attempting to create a new instance of the managed add-in class: CLR - v4.0.30319
23:43:30:107 4544 30288 Loading CLR: v4.0.30319.
23:43:30:107 4544 30288 Calling CLRCreateInstance method.
23:43:30:107 4544 30288 Success.
23:43:30:107 4544 30288 Calling GetRuntime method.
23:43:30:107 4544 30288 Success.
23:43:30:107 4544 30288 Checking if the hosting API of .NET Framework v4.0 beta is installed.
23:43:30:107 4544 30288 The hosting API is up to date.
23:43:30:107 4544 30288 Calling SetDefaultStartupFlags method.
23:43:30:107 4544 30288 Success.
23:43:30:107 4544 30288 Calling GetInterface method for the CorRuntimeHost interface.
23:43:30:107 4544 30288 Success.
23:43:30:107 4544 30288 Starting CLR...
23:43:30:107 4544 30288 Success.
23:43:30:107 4544 30288 Getting the CLR version.
23:43:30:107 4544 30288 The CLR v4.0.30319 has been initialized successfully.
23:43:30:134 4544 30288 Creating a new domain setup.
23:43:30:134 4544 30288 Success.
23:43:30:134 4544 30288 Getting the add-in directory.
23:43:30:134 4544 30288 Success. The directory is 'C:\XF\Source\Client\Windows\OneStreamExcelAddIn\bin\Debug\'
23:43:30:134 4544 30288 The configuration file is 'C:\XF\Source\Client\Windows\OneStreamExcelAddIn\bin\Debug\OneStreamExcelAddIn.dll.config'
23:43:30:134 4544 30288 The 'shadow copy' is disabled.
23:43:30:134 4544 30288 Creating a new application domain.
23:43:30:135 4544 30288 Success.
23:43:30:135 4544 30288 Creating an instance of the managed class. Assembly identity: 'OneStreamExcelAddIn'
23:43:30:278 4544 30288 Success.
23:43:30:278 4544 30288 Unwrapping the managed class.
23:43:30:278 4544 30288 Success.
23:43:30:278 4544 30288 Querying the add-in extensibility.
23:43:30:278 4544 30288 Success.
23:43:30:278 4544 30288 Querying the custom task panes.
23:43:30:278 4544 30288 Success.
23:43:30:278 4544 30288 Querying the ribbon extensibility.
23:43:30:278 4544 30288 Success.
23:43:30:278 4544 30288 Querying the form regions.
23:43:30:278 4544 30288 Success.
23:43:30:278 4544 30288 Querying the encryption provider.
23:43:30:281 4544 30288 The 'EncryptionProvider' interface is not supported.
23:43:30:281 4544 30288 Getting the dispid of the 'Dispose' method.
23:43:30:281 4544 30288 Unknown name.
Posted 28 Jul, 2021 10:51:45 Top
Andrei Smolin


Add-in Express team


Posts: 18338
Joined: 2006-05-11
Hello,

I suppose you need to create an add-in Express project as described in section Your first Excel Automation add-in, see the PDF file in the folder {Add-in Express}\Docs on your development PC. Then move your *unctional* code to the add-in module.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Jul, 2021 09:26:14 Top
rberry51




Posts: 3
Joined: 2021-07-28
Hello Andrei,

I have attempted this as well and notice interesting behavior. So, the documentation says to create a COM add-in, and then add another project for the Excel COM add-in. When I follow those instructions precisely, I see that the add-in containing functions I wish to be loaded with a signed loader shows up again as using mscoree.dll -- something like the following:

AddInExpressTest.AddInModule <-- Primary/starting project with largely nothing included (Shows up as adxloader64.dll with the proper signature)
AddInExpressTest.ExcelAddInModule1 <-- shows up as an additional Excel Add-in -- here is where I placed my test function I'm adding but it shows as being loaded by mscoree.dll and not adxloader.
Posted 02 Aug, 2021 15:08:43 Top
Andrei Smolin


Add-in Express team


Posts: 18338
Joined: 2006-05-11
Hello,

In the general case, an Add-in Express based Automation add-ins loads into the default AppDomain. You can try to make it load into your COM Add-in's AppDomain - to do this, you call a UDF defined in your Automation add-in *before* Excel invokes it. I don't think this would be possible to achieve in *all* scenarios.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Aug, 2021 07:37:44 Top
rberry51




Posts: 3
Joined: 2021-07-28
Thanks for the direction -- I have read quite a bit about this and verified that it's loading my automation add-in into the COM add-in's domain; which contrary to what many others ask about on here I want the automation add-in to load into the app-domain created by axloader. I do have some code in my com-add-in that ensures my automation add-in is loaded; but I'm not actually invoking any methods in the automation add-in. I'd like to have it live in it's own, signed/trusted, axloader created app-domain. Any tips on forcing them to be different?
Posted 03 Aug, 2021 12:21:29 Top
Andrei Smolin


Add-in Express team


Posts: 18338
Joined: 2006-05-11
Hello Ryan,

An Add-in Express based Automation add-ins loads into the default AppDomain unless your COM add-in invoks its method before Excel does it: if succeeded, the Automation add-in and the COM add-in loads into the same AppDomain. These are only options available. That is, an Excel Automation add-in can't be loaded into a non-default AppDomain different from the AppDomain of a COM add-in.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 04 Aug, 2021 01:23:55 Top