VSTO freezes Excel.exe even out of Debugging
-
Sunday, March 04, 2012 2:59 PM
Hi,
Why VSTO locks Excel even when not debugging?
If I have a normal Excel.exe instance showing a spreadsheet, and then I launch Visual Studio to develop a VSTO document-level application:
- When VSTO document-level project is running/debugging, the original Excel.exe is not usable, i.e., not
clickable orclickable in some part of the ribbon but not in the editor (cells) area - After finishing debugging such as by pressing SHIFT+F5, the original Excel.exe can sometimes run, sometimes not
(1) is understandable since VSTO Excel-application is based on Excel.exe itself, but I don’t know why after the debugging has stopped the original Excel.exe is still not usable.
Is there a solution?
And is it possible to configure Visual Studio so that VSTO launches its own/separate instance of Excel.exe, so that it would not interfere with the Excel instance that I am using?
Bob
- Edited by Bob Sun Tuesday, March 06, 2012 8:00 AM
- When VSTO document-level project is running/debugging, the original Excel.exe is not usable, i.e., not
All Replies
-
Tuesday, March 06, 2012 7:32 AMModerator
Hi Bob,
Thanks for posting in the MSDN Forum.
I can't reproduce your issue on my side. I will involve some experts into this issue. There might be some time delay, appreciate your patience.
Have a good day,
Tom
Tom Xu [MSFT]
MSDN Community Support | Feedback to us
-
Tuesday, March 06, 2012 8:02 AM
Tom,
Thanks for trying. This is not the principal problem at the moment however; could you look into VSTO + WebBrowswer: incompatible ! first?
Bob
-
Thursday, March 08, 2012 4:24 PMModerator
Hello Bob,
When you Start VSTO to debug your document level project you
say the original instance of Excel is locked.
If you have opened the workbook in Excel, then attach the VSTO project
to that workbook, since it is already opened in Excel that instance locks the
workbook from modification by other users – including your project. The VSTO
project is treated just as someone else will be treated. Only one party can
modify a single worksheet at any time.When you build your VSTO project as an Excel 2007 or 2010
Workbook project the second dialog is headed with the caption “Select a
Document for Your Application. In which you are asked whether you want to create
a new document of Copy an existing document. Be sure the workbook you specify
as the one to use as a Copy is not open in Excel at that time. Browse to the
workbook you want to use and select it. When you start debugging a second copy
of the workbook opens outside the Visual Studio workspace. You can edit the
worksheet in that, and save the document. The version of the worksheet
displayed within the VS workspace can’t be edited because the other copy tells
Excel to lock out other users – i.e. your VS project. Now you can debug your
code and at the same time, edit the contents of the workbook copy. When you
save that workbook it will be the original workbook with all the changes.Meanwhile, the copy of the workbook is still locked out
until you close the instance of Excel that is outside the VC workspace. After all of that, none of the changes you made in the worksheet is in the original workbook in your “My Documents”
library. They are saved in the copy of the original, with the same name, in the same folder as your VC project.Your question about configuring VSTO so that it launches its
own/separate instance of Excel.exe the answer is you can do so by specifying a
new document in the “Select a Document For your Application” dialog. That attaches your project to a new Excel process with a blank workbook.Please click the “Mark as Solution” button if this reply
helps you understand the reason(s) for your issue.
Regards,
Chris Jensen
Senior Technical Support Lead.Chris Jensen
- Marked As Answer by Bob Sun Sunday, March 11, 2012 3:47 PM
-
Thursday, March 08, 2012 5:08 PMAnswerer
Hello Bob,
is it possible that you have a Modal Dialog displaying in the background?
This could be the case if you call ShowDialog() without a Parentwindow.
You can check it if you press Alt+Tab and see if there is a Window in the Back.When you Debug and you press Pause, did it stop in the Debugger?
Another Problem could be a Infinite-Loop. You can add a Debug.Break statement in your Startup-code - then you can see whats going on.
Hope this helps,
Greets - Helmut
Helmut Obertanner [http://www.obertanner.de] [http://www.outlooksharp.de]
-
Sunday, March 11, 2012 3:52 PM
Chris,
Thanks for the detailed explanation. I followed it and now VSTO runs without problem.
Helmut,
It seems not the reason that you suggested, but thanks all the same.
Bob

