add-in error after 1st run of XLL

47 views
Skip to first unread message

MAS

unread,
May 8, 2023, 12:42:29 PM5/8/23
to Excel-DNA
Hello,

I am having a strange problem with an add-in.  The add-in loads an XML file that is needed by the UDF functions (C#).  When I load the XLL, the XML file gets loaded and all is well.  If I close Excel (2021 32-bit) and then restart, the add-in throws some errors (below).

Any idea what's causing this to fail after it has already run correctly when the add-in was first installed?

Regards,
Mark 

Initialization [Warning] Assembly MSCORLIB.XMLSERIALIZERS could not be loaded from resources.
Initialization [Error] DnaLibrary AutoOpen Error : TargetInvocationException - Exception has been thrown by the target of an invocation.

MAS

unread,
May 8, 2023, 2:33:45 PM5/8/23
to Excel-DNA
I think I figured it out.  My XLL is calling two DLLs.  Initially, the DLLs think they are in their original folder.  After Excel is closed and opened again System.IO.Directory.GetCurrentDirectory() is now pointing to the user's document folder while the ExcelDnaUtil.XllPath in the calling UDF is pointing to the location of the XLL and the DLL files.

I suppose I have to ask why it works on the first run.  But I will need to send it the XLL folder location.
Reply all
Reply to author
Forward
0 new messages