Andrei Smolin

Excel 2016 crashes if COM add-in creates a command bar control in a built-in context menu

This is the second post in our series of blogs targeted to Office [and Add-in Express] developers who need to know about [serious] problems [and solutions] related to Microsoft Office [and/or Add-in Express products] as early as possible.

Issue

Today’s blog is about a recent crash reported by our customer (Thank you, Alain!). Our research shows that the crash occurs if your VSTO add-in or COM add-in creates a command bar control on a built-in context menu. We reproduce the crash when customizing the Cells context menu in this way. To find the cause of the issue and to create a reference page, we’ve reported the issue on the Excel for Developers forum (see here). The forum moderators confirmed the issue (Thank you, Celeste! You are always very helpful!) and we reported it to Microsoft. Now our status is “waiting for a potential Excel update fixing this issue”.

When writing these words, we know that affected are Excel 2016 builds from 8325.2121 to 8730.2046.

Both VSTO and non-VSTO developers are affected by the issue. VSTOers can find a sample VSTO code on the page above.

As to Add-in Express developers, to reproduce the issue you need to use an ADXContextMenu component creating a command bar control on an Excel context menu.

Workaround

Hey, they’ve fixed it! The issue doesn’t show up in Excel 2016 8730.2102!

Anyway, we recommend that you switch to Ribbon context menus when your add-in is loaded in Excel 2016; see the Application.Version property. Add-in Express developers can find that their add-ins are loaded in Excel 2016 by checking the HostType and HostMajorVersion properties of the ADXAddinModule class; HostMajorVersion returns 16 if your add-in is loaded by Office 2016.

HTH

Post a comment

Have any questions? Ask us right now!