views:

418

answers:

2

Visual Studio 2008 has been running well for quite awhile now. I've used it for web, console, windows form, WPF, WCF, and class library projects. All has worked, until today.

Now, whenever I try to start a new windows form project (regardless of .NET version), it crashes with the message,

vshost.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

<irrelevantRemark>Sure, you're sorry...</irrelevantRemark>

I've tried starting other kinds of projects and they all work fine. The issue has to do only with starting or opening windows form projects.

In surfing for a solution, the only thing I can find is to ,

  • go into the project properties
  • select debug tab
  • uncheck "Enable the Visual Studio hosting process"

When I do that, it seems to work fine.

In one way then, I have a work around that seems to work (at least so far). I just have no idea why I have to do this. Is there a real 'fix' other than this hack?

** Additional Info - part 1**
- I have started visual studio in "safe mode", by using devenv /safemode (no effect)
- using windows xp
- no add-ins to disable

** Additional Info - part 2**
I've tried attaching a debugger, but either I'm doing something wrong (could be) or it just won't let me. Here's what I've done.

When the crash box pops up, if I try the debug button, then the Visual Studio Just-in-Time Debugger won't work. The debugger window will have, "An unhandled win32 exception occured in [the project name].vshost.exe[some number - will often change], but that's all the info I can get (that I know how). No matter what I'll choose, I'll get a message, "Unable to attach to the crashing process".

Ok, so I then re-enable the VS hosting process, go to debug->attach to process, but I can't attach vshost.exe at that point either. In the available processes to debug, it'll be grayed out.

** Additional Info - part 3**
- downloaded the Android SDK yesterday, but I don't see it running as a current process or installed "program". Not currently running either.
- Also have Eclipse Galileo build, but not running.

A: 

Have you installed any programs that have shell hooks recently? Such as TortoiseSVN, which allows you to right-click files in the file explorer to check them in, etc using SVN? This sounds like a shell hook problem. Shell hooks are DLL's that get inserted into processes that use Windows shell features such as the "open file dialog".

The VSHost process helps Visual Studio debug GUI applications, and if it is failing on a "clean" WinForms project it is either a configuration issue with the .NET framework or Visual Studio or it is a shell hook issue. You may want to try attaching the debugger to vshost.exe and look at the list of loaded DLL's, looking for anything odd.

David Gladfelter
Thanks - It will happen regardless of whether it's a clean winforms project or not. Even on existing winforms project I'll have vshost.exe crash. I supplied some additional information above as well as tried to attach a debugger on VSHost but no luck.
Anjisan
The Winternals' (now owned by Microsoft) "Process Explorer" application lets you look at the loaded DLL's on a running application. You could use that to see what modules are loaded into the vshost process.
David Gladfelter
A: 

You can use windbg to analyze the stack trace and what probably caused the bug, some tutorials.

http://blogs.msdn.com/johan/archive/2007/01/11/how-to-install-windbg-and-get-your-first-memory-dump.aspx

and

http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.aspx

It may seems overkill, but it windbg will surely be useful to you for other problems.

Nicolas Dorier
Thanks - I'll give that a try
Anjisan
Any luck? Could you post your results here? I'm hitting a similar problem.
Scott Bilas