Hello,
After a few days of usage, the addin ribbon cannot be loaded anymore (it is not disabled).
COMException with DISP_E_BADINDEX error occurred in ExcelComAddInHelper.LoadComAddIn around the line:
comAddIn = excelComAddIns.GetType().InvokeMember("Item", BindingFlags.InvokeMethod, null, excelComAddIns, new object[] { progId }, ci);
When looking at the list of items, all exceldna addins are not present.
Full callstack:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException: Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
--- 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)
This is the exact same exception described at https://groups.google.com/forum/#!msg/exceldna/FzkZz9giA4M/mTNkqLSPP1MJ.
It happen on one of our client using Office 2013 x86 on Windows 8.1 x64 and only happen after a few days of usage.
User does not have administrative rights, thus the registration is done in HKCU. UAC is enabled.
We use the latest version of ExcelDNA (currently 0.33.9).
Rebooting the computer fix the issue but it occurred again after a few days.
I've tried all workaround described on those two articles but unfortunately none of them fixed the issue.
https://groups.google.com/forum/#!msg/exceldna/FzkZz9giA4M/mTNkqLSPP1MJ
I’ve also made some registry traces (ProcessMonitor) before and after the issue and it appear that at some point, the key is not registered at the same place, resulting in a NOT_FOUND when excel tries to read it back.
Working:
Process Name Operation Path Result Detail
EXCEL.EXE RegOpenKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672\Software\Classes\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\CLSID REPARSE Desired Access: Read/Write
EXCEL.EXE RegOpenKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672_CLASSES\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\CLSID NAME NOT FOUND Desired Access: Read/Write
EXCEL.EXE RegCreateKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672\Software\Classes\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\CLSID REPARSE Desired Access: Read/Write
EXCEL.EXE RegCreateKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672_CLASSES\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\CLSID NAME NOT FOUND Desired Access: Read/Write
EXCEL.EXE RegCreateKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672_CLASSES\Dna.4c9ad8da6aa653248b7340f81c7832a8.0 SUCCESS Desired Access: Maximum Allowed, Granted Access: None 0x0, Disposition: REG_CREATED_NEW_KEY
EXCEL.EXE RegOpenKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672_CLASSES\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\Clsid SUCCESS Desired Access: Query Value
Not working:
Process Name Operation Path Result Detail
EXCEL.EXE RegOpenKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672\Software\Classes\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\CLSID NAME NOT FOUND Desired Access: Read/Write
EXCEL.EXE RegCreateKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672\Software\Classes\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\CLSID NAME NOT FOUND Desired Access: Read/Write
EXCEL.EXE RegCreateKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672\Software\Classes\Dna.4c9ad8da6aa653248b7340f81c7832a8.0 SUCCESS Desired Access: Maximum Allowed, Granted Access: None 0x0, Disposition: REG_CREATED_NEW_KEY
EXCEL.EXE RegOpenKey HKU\S-1-5-21-337817132-3591569431-2285286604-1672_CLASSES\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\Clsid NAME NOT FOUND Desired Access: Query Value
EXCEL.EXE RegOpenKey HKCR\Dna.4c9ad8da6aa653248b7340f81c7832a8.0\Clsid NAME NOT FOUND Desired Access: Query Value
Difference between 1st and 2nd is the REPARSE missing and the fact that it is written in SID_CLASSES instead of Software\Classes.
As a workaround, in ComRegistration.cs, in “public static RegistryKey ClassesRootKey”, I’ve changed
Registry.CurrentUser.CreateSubKey(@"Software\Classes", RegistryKeyPermissionCheck.ReadWriteSubTree);
to
Registry.Users.CreateSubKey(WindowsIdentity.GetCurrent().User + "_CLASSES", RegistryKeyPermissionCheck.ReadWriteSubTree);
to force the same path as excel and the addin is not disabled anymore. However, not sure it is safe to do that.
Any ideas?
Thanks.
Best regards,
Sebastien
Hi Sebastien,
Thank you very much for your detailed investigation!
I’ll have a closer look at what you’ve found, and your suggested fix.
-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 post to this group, send email to exce...@googlegroups.com.
Visit this group at https://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.
Great - thank you!
-Govert
To post to this group, send email to exc...@googlegroups.com.