I get a TargetInvocationException on the load of my AddIn.
specifically at the call : comAddIn.GetType().InvokeMember("Connect", BindingFlags.SetProperty, null, comAddIn, new object[] { true }, ci);
What is very weird is that this exception is only thrown when the XLL is loaded from an specific path on my computer.
That is, if I change the name of the XLL file or the directory everything works just fine.
I tried to clear the registry using apps, and manually, but nothing has changed.
Full Exception:
The Ribbon/COM add-in helper required by add-in {0} could not be registered.
This may be due to the helper add-in being disabled by Excel.
To repair, open Disabled items in the Options->Add-Ins page and re-enable target add-in, then restart Excel.
Error details:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
--- End of inner exception stack trace ---
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
at ExcelDna.Integration.ExcelComAddInHelper.LoadComAddIn(ExcelComAddIn addIn) in ...\ExcelDna.Integration\ExcelComAddIn.cs:line 145
Do you have any clue about what is happening, or how to fix this?
Best regards,
Marcio