NET8 and failure to load assembly

94 views
Skip to first unread message

Henrik Teneberg

unread,
Jun 3, 2024, 6:45:20 AMJun 3
to Excel-DNA
Hi,

I am in the process of upgrading my 32-bit addin from .NET6 / ExcelDNA 1.6.0 to NET8 / ExcelDNA 1.8.0.

Essentially, I have a "loader addin" that loads another addin dynamically, where the idea is to have the loader addin static and change only for .NET upgrades, and the dynamically loaded addins can change at any time.

I have done the following:
1. Installed .NET8 SDK and desktop runtime 32 and 64 bit
2. Upgraded ExcelDNA from 1.6.0 to 1.8.0
3. Upgraded both my addins from NET6 to NET8

After step 2 everything still works as normal, but after step 3, loading of the dynamically loaded addin fails (the call is XlCall.Excel(XlCall.xlfRegister, xllFile);) with the following error (read via image textreader):

Assertion failed!
Program:
...NameOf-My-Addin.xll
File: ...\ExcelDna.Host\host-.cpp
Line: 64
Expression: load_assembly_and_get_function_pointer !=
nullptr  && "Failure: get_dotnet_load_assembly()

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)


I have looked in host.cpp in Github (master branch, as I dont seem to find a 1.8.0 tag), but I do not get much wiser.

What can be the source of this issue? What more can I investigate on my side?

Thanks in advance
Henrik

Govert van Drimmelen

unread,
Jun 4, 2024, 8:03:01 PMJun 4
to Excel-DNA
Hi Henrik

Is your Excel installation 32-bit or 64-bit?

The Excel-DNA build task ensures that the right version of the (loader) add-in loads when debugging, but you'll have to do this yourself for the subsequently loaded add-ins.

From your error message it looks like you're loading the 32-bit version.

-Govert


--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/d2fcf0d9-d581-48ae-af15-e1ff12016c49n%40googlegroups.com.

Henrik Teneberg

unread,
Jun 5, 2024, 3:56:56 AMJun 5
to Excel-DNA
Hi Govert,

Thank you for your reply!

No, I am using Excel 32-bit and <ExcelDnaCreate64BitAddIn>false</ExcelDnaCreate64BitAddIn> so that was not the problem.

However, your reply had me thinking a second round, and I realized I had forgotten to update the generic xll and dna, that the host addin uses to dynamically load the inner addin (which is shipped as a library only), to 1.8.0 versions. Those are not produced automatically by the build task, but rather shipped as a separate zip file. Updating those solved the problem.

Thanks!
Henrik
Reply all
Reply to author
Forward
0 new messages