Excel PIAs: Who you calling Dummy–Dummy?

When you look at the Excel PIA in the object browser in Visual Studio, you will quickly notice what appears to be method centric name calling: a slew of methods with the text “Dummy” in them.  There’s even an interface called IDummy (implement this interface to indicate you are a dummy).

No, this isn’t Excel’s way of insulting your intelligence.  Everything with “Dummy” in it is a test method that actually has a legitimate purpose and more descriptive names in the debug version of Excel (for example Application.Dummy6 is called Application.DebugMemory in the debug version of Excel), but are renamed to “Dummy” in the retail version of Excel.  All these “Dummy” methods (I count 508 of them) actually do something in debug Excel, but in retail Excel they all return E_FAIL–e.g. they don’t do anything.

Excel has marked these as “hidden” in the COM typelibrary–and when the PIAs were created, this hidden information is transferred over by TLBIMP using the TypeLibFuncAttribute’s FUNCFLAG_FHIDDEN flag.  But most object browsers aren’t looking for this–so when you view the PIA in the object browser you see these “Dummy” methods regardless of whether the “Show Hidden Members” command in the object browser is selected or deselected.  Feature request for reflector or the Visual Studio object browser–look for the TypeLibFuncAttribute’s FUNCFLAG_FHIDDEN flag and hide these methods and properties.

You can actually see these Dummy methods in VBA too–but you have to right click on the classes list in object browser and choose “Show Hidden Members” and thhe Dummy methods will appear there too.

This is more noise that is ignorable when browsing the Excel PIA in the object browser.

[Thanks to Adam Nathan!–corrected this post–hidden information is transferred over via the TypeLibFuncAttribute, but most object browsers don’t look for this attribute.]

Comments (5)

  1. Adam Nathan says:

    Actually, TLBIMP does transfer the "hidden" marking via the TypeLibFuncAttribute. So an object browser *could* decide to look for that attribute and see if TypeLibFuncFlags.FHidden is set. It’s not pretty, but it works!

  2. Stephane Rodriguez says:

    While we are at it, why doesn’t the PIA clean up the incredibly unsmart 30-parameter methods like Run() expecting 30 non-optional such parameters, and make them available more elegantly to the outside world. What are PIA good for other than a better abstraction?

  3. Eric Carter says:

    Thanks Adam–I corrected this post.

  4. Octavius says:

    Office 2003 主 Interop 程序集的安装和使用

  5. 可心 says:

    Office 2003 主 Interop 程序集的安装和使用