Ribbon issue

310 views
Skip to first unread message

Farhan Ahmed

unread,
Jul 25, 2012, 5:21:33 PM7/25/12
to exce...@googlegroups.com
I'm just dealing with one issue after the next today :-|. I've spent a couple of hours on this one already ... so any help would be appreciated!

I can't get any Ribbon controls to show - not in the samples, not in my code. Used to all work before I had to re-install VS2010 and Office 2010.

Once again, I added the ExcelDNA project as a project dependency and traced the failing code to:

comAddIn = excelComAddIns.GetType().InvokeMember("Item", BindingFlags.InvokeMethod, null, excelComAddIns, new object[] { progId }, ci);

This is in \ExcelDNA\Source\ExcelDna.Integration\ExcelRibbon.cs. 

The problem I think is that the excelComAddins collection only has 2 add-ins and the one referred to by the progId is not one of them. The exact exception is as follows:

System.Reflection.TargetInvocationException was caught
  HResult=-2146232828
  Message=Exception has been thrown by the target of an invocation.
  Source=mscorlib
  StackTrace:
       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.CustomUI.ExcelComAddInHelper.LoadComAddIn(ExcelComAddIn addIn) in C:\code\ExcelDNA\Source\ExcelDna.Integration\ExcelRibbon.cs:line 186
  InnerException: System.Runtime.InteropServices.COMException
       HResult=-2147352565
       Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
       Source=""
       ErrorCode=-2147352565
       InnerException: 

I've verified that the registry settings being created in the constructors of ProgIdRegistration and ComAddInRegistration are indeed being written through.

Govert - any idea why the COMAddIns invocation doesn't return the dynamic add-in in the collection?

Thanks,

--
Farhan Ahmed

Farhan Ahmed

unread,
Jul 25, 2012, 5:39:36 PM7/25/12
to exce...@googlegroups.com
This gets weirder. So I used Process Monitor to see the registry accesses around this code block and filtered out only the ones with the ProgId in them (to remove the noise). Here's what it looks like:

0 4:31:49.5065299 PM EXCEL.EXE 3352 RegCreateKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd SUCCESS Desired Access: Maximum Allowed, Granted Access: None
1 4:31:49.5066223 PM EXCEL.EXE 3352 RegSetInfoKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd SUCCESS KeySetInformationClass: KeySetHandleTagsInformation, Length: 0
2 4:31:49.5066739 PM EXCEL.EXE 3352 RegQueryKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd SUCCESS Query: HandleTags, HandleTags: 0x401
3 4:31:49.5067589 PM EXCEL.EXE 3352 RegCloseKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd SUCCESS
4 4:33:15.0739836 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Read
5 4:33:15.0741476 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Read
6 4:33:15.0743951 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Maximum Allowed
7 4:33:15.0745563 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Maximum Allowed
8 4:33:15.0750236 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Read
9 4:33:15.0751849 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Read
10 4:33:15.0754185 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Maximum Allowed
11 4:33:15.0755724 PM EXCEL.EXE 3352 RegOpenKey HKCU\Software\Classes\AddIn.3dc5c2013b3c4269b61202cd8831bfcd NAME NOT FOUND Desired Access: Maximum Allowed

As you can see, the registry key is created successfully (by the constructor of the ComAddinRegistration class) but when Excel tries to open it (during the 'COMAddins' method invocation), it gets back ERROR_NOT_FOUND!

What a weird condition - I don't want to say it, but it seems like a registry cache issue (this is Windows 8 preview release). Thoughts?

Farhan

Govert van Drimmelen

unread,
Jul 25, 2012, 5:52:14 PM7/25/12
to Excel-DNA
Hi Farhan,

Could you check whether there are any add-ins in Excel's Disabled
list?
Go File->Options->Add-Ins. Then at the bottom pick Manage: Disabled
Items and see what you find.


If you have some crashes in your add-in while the ribbon is loading,
Excel will mark it as disabled and not load it again.

Regards,
Govert
> > *Govert *- any idea why the COMAddIns invocation doesn't return the

Farhan Ahmed

unread,
Jul 25, 2012, 5:58:43 PM7/25/12
to exce...@googlegroups.com
There are no disabled add-ins.


--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To post to this group, send email to exce...@googlegroups.com.
To unsubscribe from this group, send email to exceldna+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/exceldna?hl=en.

Farhan Ahmed

unread,
Jul 25, 2012, 6:07:05 PM7/25/12
to exce...@googlegroups.com
You've got to be kidding me - I restarted my system and it installed an update during shutdown, when the system can back up things are working fine! Looks like things were just whack due to some inconsistent state.

That's it, I give up, on my way to grab beer ....

Govert van Drimmelen

unread,
Jul 25, 2012, 6:12:58 PM7/25/12
to Excel-DNA
OK,

My understanding is this:

* This is a Windows 8 Consumer Preview machine which had Excel 2010 on
before, and everything including Excel-DNA ribbons were fine.
* Then you installed Office 2013 Customer Preview, and stuff didn't
work.
* Then you uninstalled Office 2013 and Office 2010 was still broken.
* Then you reinstalled Office 2010 (without changing or reinstalling
your Windows) and everything except the Excel-DNA ribbons seems to
work.


-----
As I write this I see your happy message that it was fixed after a
reboot...

Glad it's working again - enjoy your beer!

Cheers,

Farhan Ahmed

unread,
Jul 25, 2012, 6:40:53 PM7/25/12
to exce...@googlegroups.com
Close. Here's the sequence:

* This is a Windows 8 Consumer Preview machine which had Excel 2010 on
before, and everything including Excel-DNA ribbons were fine.
* Then you installed Office 2013 Customer Preview, and stuff didn't
work.
* Then you uninstalled Office 2013 and Office 2010 was still broken.
* Used the Windows 8 'Refresh PC' feature to roll back to vanilla Windows 8* 
* Then you reinstalled Office 2010 (without changing or reinstalling
your Windows <= see above) and everything except the Excel-DNA ribbons seems to
work. 
Reply all
Reply to author
Forward
0 new messages