Several users of my VSTO add-ins report hangs that occur when a "Save as" dialog should be displayed. This happens with an Excel add-in as well as a Word add-in. Interestingly, both applications also tend to hang when invoking the "Save as" command on a document.
I am having a hard time to troubleshoot this because the entire application just freezes after
// using System.Windows.Forms;
SaveFileDialog dlg = new SaveFileDialog();
// lines to configure dlg left out
dlg.ShowDialog();
When attempting to close Excel or Word in this situation, a message box "Excel/Word can not be closed" appears, and people have to resort to the Task Manager to get rid of it.
The fact that both Excel and Word frequently hang on "Save as" is particularly disturbing, because I don't see how my add-ins interfere with the built-in "Save as" commands of these applications.
To make matters worse, the add-ins need not even be loaded. Deactivating them by unchecking the corresponding entry in "COM add-ins" and restarting the application does not solve the problem. I have to completely remove the add-ins to make sure "Save as" does not freeze the application.
This makes me think that it is not code in my add-ins that is the problem, but the mere presence of an (inactive) VSTO add-in that prevents a file dialog from appearing, thereby causing a hang.
The hangs do not always occur, and not on all machines. It's quite random.
How would I go about investigating this further? I have Visual Studio Professional 2013, but do not know how to find out why and where the Office application freeze.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…