Why is this custom backstage UI for Word not displaying its user interface?
Asked Answered
T

1

11

I have an Office addin which uses the following backstage XML to add custom UI elements into Microsoft Word backstage:

<?xml version="1.0" encoding="UTF-8"?>
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load">
  <backstage onShow="Backstage_OnShow">
    <tab idMso="TabSave">
      <firstColumn>
        <taskFormGroup idMso="SaveGroup">
          <category idMso="Save">
            <task id="myCustomTask" label="My Custom Task" insertAfterMso="ButtonTaskDynamicServiceProvider">
              <group id="myGroupInTabSave" label="Custom functionality" helperText="This group contains custom functionality.">
                <primaryItem>
                  <button id="myButton" label="My Button" onAction="CallMe" />
                </primaryItem>
              </group>
            </task>
          </category>
        </taskFormGroup>
      </firstColumn>
    </tab>
  </backstage>
</customUI>

This is the exact base-case scenario described here to modify the Save As dialog.

On my machine, it does not show anything under Save As. I do however see that the following function gets called when the backstage is shown:

public void Backstage_OnShow(object contextObject) {
    // It hits this method.
}

What are some of the reasons why the UI will not show, and also, how can I debug what is going on here? I tried turning on Show add-in user interface errors in the Advanced tab of Word Options, under the General section, but it doesn't display any errors to me, as far as I can tell.

Not sure if it helps, but our ribbon inherits IRibbonExtensibility.

We've also found this logic sometimes works on some machines but not on others. I am clueless as to why...one thing I can tell you that is definitely different is that the types for this addin are registered with regasm instead of the addin being installed using a path|vstolocal registry key under Outlook's registry. In other words, we are using regasm to install the addin.

Edit: I have tried the suggested answer but it is still not working given that approach. My team and I are pretty convinced at this point that this is a major VSTO bug and we have cooked up a project to showcase it. This project showcases backstage bugs with Windows 10 Pro 64-bit version 1607 (OS build 14393.351) and 32-bit Word 2016 16.0.7426.1009 (Office 2016 32-bit version 1610, build 7466.2023): https://github.com/Star-Lord-0x539/WordAddin1

If you run this sample on the same or similar environment, you can see that if you click the Home tab at the top of Word, you will see the button that is defined in https://github.com/Star-Lord-0x539/WordAddin1/blob/master/WordAddIn1/Ribbon1.xml, but, if you open up the backstage you don't see the sample tab that should be inserted after the info tab, TabInfo (this screenshot was taken with a release build run in debug mode directly from Visual Studio, and I can see the addin is registered up and everything as well):

enter image description here

The only thing that you will see is this (this is also proof the addin is running and registered to its local VSTO file):

enter image description here

Edit: This also affects Office 64-bit. I just installed Word 2016 16.0.7426.1009 (Office 2016 64-bit version 1610, build 7466.2023) thinking that changing to x64 might help, but I still experience the same issue on my machine.

Edit: This also affects today's release of Windows 10 Pro x64 version 1607, build 14393.447. Also, I have tried disabling all other addins, still the same thing.

Thaumaturge answered 4/11, 2016 at 20:19 Comment(21)
I'm not sure if this is the issue which you have, but you didn't say you have registered the ribbon. When you create an XML ribbon, you should override CreateRibbonExtensibilityObject and return an instance of ribbon.Corrida
The element you defined are not TabInfo elements, they are elements for a Sample tab which is inserted after TabInfo and shows properly.Corrida
@RezaAghaei I don't see it anywhere in backstage. Like for example, what you see, I am fairly certain I don't. How do you navigate to it?Thaumaturge
For me it's inserted after TabInfo. See the imageCorrida
Since you was using .NET 4.5.2 and a different version of office interops and the key file was password prottected, I just created a clean project and used the XML you provided.Corrida
@RezaAghaei The password for the PFX certificate is password (its just a random certificate I generated using Windows crypto libraries [dima.to/blog/?p=290]), but, like I said, you should try it in the same environment as me, under Windows 10 Pro 64-bit version 1607 (OS build 14393.351) and 32-bit Word 2016 16.0.7426.1009 (Office 2016 32-bit version 1610, build 7466.2023) (these are the latest updates by the way). I've provided a screenshot to show what I see in this situation.Thaumaturge
Also, no matter what version of .NET 4.X I target, the results are the same.Thaumaturge
@RezaAghaei I would expect to see what is in your image as well, but for some reason I do not. It is not just me that has the issue, I have some other guys on my team who are experiencing this on similar environments they have on some of their other PCs. I think its a bug.Thaumaturge
@RezaAghaei Reza, is the code for Ribbon1.xml and ThisAddIn.cs the same as yours? Also, how does the ThisAddIn.Designer.cs compare with yours?Thaumaturge
@RezaAghaei This is definitely a bug with Windows 10 64 bit and Office 32 bit because if I copy the release assemblies to a different system (64-bit version of Windows 8.1 with 64-bit Office 2013) and install using |vstolocal in the registry, it all works and I see the tab like you do.Thaumaturge
If you are sure about that, you can post it a answer. Also if you share ad email address, I can send my project for you to make sure if it has the same problem in your system.Corrida
@RezaAghaei My only reservations for not posting it as an answer is that someone may come along from Redmond or elsewhere who is more knowledgeable on the subject, pinpoint the issues with those environments, and be able to find a solution for us with the current build. My gut tells me its a bug but you never know.Thaumaturge
So wait until the last day of the bounty. If you post your own answer I guess you will decrease the chance of receiving an answer.Corrida
@RezaAghaei Good call. Again, thanks a bunch for helping out!Thaumaturge
You're welcome, by the way take a look at this link and this one. Maybe you can solve the problem by playing with Embed Interop Types since the problem may be related to different bitness.Corrida
@RezaAghaei They are embedded. Can you post a project that works for you somewhere so I can try it out in my environment?Thaumaturge
Sent. The first email was empty by mistake, the second one is OK. Let me know if you had any problem using the solution.Corrida
@RezaAghaei I got it. I can guarantee you 100% that it doesn't work on this environment. Same solution and everything! This is mental... Thanks a lot by the way!Thaumaturge
The sample from your question as well as the GitHub sample both work for me. There must be something else going on in your environment. Maybe there is another add-in overwriting your customization?Inequitable
@DirkVollmar I've disabled all of the other add-ins, except for the one I am testing out, but its still not working for me. I also have UI errors on, but that doesn't display anything. I am at a real loss here.Thaumaturge
Guys, its an Office bug, 100% sure. My team and I found that forcing yesterday's update to the latest Office version fixes this backstage bug. This is really kind of scary because we produce Office add-ins and we really rely on VSTO add-in functionality to work, such as this backstage UI support. Now it seems we must also support customers who have obscure bugs because the reliability is not quite there with this technology.Thaumaturge
T
4

This is a bug with Office. I can confirm in my environment, this worked again after updating Word manually with the November 8 update which came out yesterday. This update did not show up when I tried to search for updates in Windows 10, instead I had to install it this way:

  1. Inside of Word, click File to open the backstage.

  2. Click on the Update Options drop-down.

  3. Select Update Now.

Once you update to Office version 1610, build 7466.2038, this bug goes away:

enter image description here

Thaumaturge answered 9/11, 2016 at 14:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.