Due to net6 being out of support, we have to move our addin (currently using net6.0-windows runtime and ExcelDna v1.70) to net8 (and thus ExcelDna v1.8.0).
We've updated all the csproj files, and updated the ExcelDna dependencies to 1.8.0.
On load, we now get the error message:
`Initialization [Error] No objects loaded from <x>, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null`
As far as I can tell, this happens before AutoOpen is called (at least, sticking a breakpoint inside AutoOpen didn't help).
AutoOpen code:
public void AutoOpen()
{
try
{
// As per https://groups.google.com/g/exceldna/c/lw_GTrGVxTY/m/slkXJVIHAwAJ
using var ctx = System.Runtime.Loader.AssemblyLoadContext.EnterContextualReflection(GetType().Assembly);
var sw = Stopwatch.StartNew();
Logger.Verbose("AutoOpen executing");
BsmCulture.SetAllCultureInfo();
var rval = ExcelError.ExcelErrorGettingData;
// Conversions for common parameter types
var paramConversionConfig = new ParameterConversionConfiguration()
.AddNullableConversion()
.AddParameterConversion(DisableOptionalArrays)
.AddReturnConversion(
(type, customAttributes) => type != typeof(object)
? null
: ((Expression<Func<object, object>>)
((object returnValue) => returnValue.Equals(ExcelError.ExcelErrorNA) ? rval : returnValue))
)
.AddParameterConversion(ParameterConversions.GetOptionalConversion(treatEmptyAsMissing: true));
var funcExecutionConfig = new FunctionExecutionConfiguration()
.AddFunctionExecutionHandler(CachedFunctionExecutionHandler.CacheHandler);
// This is required in order to use params: https://groups.google.com/forum/#!topic/exceldna/kf76nqAqDUo
ExcelRegistration
.GetExcelFunctions()
.ProcessAsyncRegistrations(nativeAsyncIfAvailable: false)
.ProcessParameterConversions(paramConversionConfig)
.ProcessParamsRegistrations()
.ProcessFunctionExecutionHandlers(funcExecutionConfig)
.RegisterFunctions();
IntelliSenseServer.Install();
// Customize return value for exceptions, as by default exceptions just return #VALUE.
ExcelIntegration.RegisterUnhandledExceptionHandler(e => ExceptionHandling.Handle((Exception) e));
MarketDataCenter.Init();
sw.Stop();
Logger.Verbose("AutoOpen complete in {AutoOpenDuration} seconds.", sw.ElapsedMilliseconds / 1000.0);
}
CsProj:
<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<LangVersion>latest</LangVersion>
<RunExcelDnaPack>false</RunExcelDnaPack>
<UseWindowsForms>True</UseWindowsForms>
<SelfContained>false</SelfContained>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
Dna File:
<DnaLibrary Name="<addin>- v99.99.99-pre" RuntimeVersion="v4.0">
<ExternalLibrary Path="
<addin>.dll" ExplicitRegistration="true" ExplicitExports="false" LoadFromBytes="true" />
<Reference Path="ExcelDna.Registration.dll" Pack="true" />
<Reference Path="ExcelDna.IntelliSense.dll" Pack="true" />
</DnaLibrary>
Is there anything obvious I've missed that would be causing this?
Thanks
Graeme