NetOffice icon indicating copy to clipboard operation
NetOffice copied to clipboard

Word stucks loading when using NetOffice Taskpane in combination with VSTO Document Level AddIns

Open mscc-sascha opened this issue 10 months ago • 2 comments

Issue: Word Becomes Unresponsive When Using NetOffice TaskPane and VSTO Add-In Simultaneously

Sample Solution

The issue can be reproduced using the following sample repository:
🔗 netoffice-vsto-addin-sample

Description

This sample demonstrates an issue that occurs when both a VSTO Add-In and a NetOffice TaskPane Add-In are loaded simultaneously in Microsoft Word. When both add-ins are present, Word becomes unresponsive, and the VSTO Add-In takes a long time to load, eventually timing out.

Solution Structure

The repository consists of three projects:

  • DocumentLevelAddIn: A VSTO Add-In (Document Level) with a simple ribbon action.
  • NetOfficeSampleAddIn: A TaskPane Add-In using the NetOffice library (adapted from NetOfficeFw / Samples / 02 Ribbons And Panes).
  • WordStarter: A Console Application that opens a Word document.

Steps to Reproduce

  1. Build the solution.
  2. Register the TaskPane COM Add-In using the Developer Command Prompt:
   cd "C:\Path\To\Your\Project\NetOfficeSampleAddIn\bin\Debug\Debug"
   regasm /codebase Word02AddinCS4.dll
  1. Add C:\Path\To\Your\Project\ as a Trusted Location in Word 3.1 Open Word 3.2 Go to Word Options → Trust Center 3.3 Navigate to Trusted Locations → Add new location 3.4 Add the project directory

  2. Run the WordStarter Console Application 4.1 Run the WordStarter console application. 4.2 Observe that Word opens, but the DocumentLevelAddIn takes a very long time to load and blocks the Word document when opened!

Expected Behavior

  • The VSTO Add-In should load normally without any delays or timeouts.

Actual Behavior

  • Word becomes unresponsive when both add-ins are present.
  • The VSTO Add-In takes an extremely long time to load and may time out.
  • This issue does not occur when using a TaskPane Add-In that was developed with VSTO instead of NetOffice.

Additional Information

This repository serves as a demonstration for a GitHub issue reported to the NetOffice project. Any insights into resolving this conflict between VSTO and NetOffice TaskPane Add-Ins would be appreciated.

mscc-sascha avatar Feb 04 '25 09:02 mscc-sascha

Hi @mscc-sascha, thanks for creating the sample repository.

I tested the solution and the performance is normal on my machine.

Do you see slow performance when you have release build of the addins and you won't attach the debugger to Word?

jozefizso avatar Feb 05 '25 13:02 jozefizso

Hi @jozefizso Thanks for having a look into it!

Did you test the solution when running the WordStarter Console Application? It is important to have both Add-Ins running: The Document-Level (VSTO) Add-In and NetOffice Taskpane Add-In. If the Document-Level Add-In is not appearing, the exection directory has to be added as a Trusted Location in Office. Can you confirm, both Add-Ins are running simultaneously?

The issue is actually not only about the slow performance while startup, also loading of the VSTO Add-In times out, therefore it is not available anymore. This also happens in a release build without a debugger beeing attached.

mscc-sascha avatar Feb 06 '25 08:02 mscc-sascha