none
vshost has stopped working... (DEP problem) RRS feed

  • Question

  • Hi All,

    I have VS2008, Windows Vista 32 bit SP1,

    Everytime I start a new WPF application template and try to debug it, I got this crash message when I close my window:

    =============
    [Window Title]
    Microsoft Windows

    [Main Instruction]
    vshost.exe has stopped working

    [Content]
    Windows is checking for a solution to the problem...

    [Cancel]
    ============

    When I close the window I have the following message from the taskbar about DEP. I try to follow the advice and turn off DEP for Visual Studio but it is apparently impossible (I have an error message saying that VS MUST run with DEP).

    What can I do?!?


    Also, the funny thing is, if I try the sample WinForm application I have no crash, it's all working fine...

    • Moved by waldenk - MSFT Tuesday, July 22, 2008 1:15 AM This appears to be a vshost issue
    Monday, July 21, 2008 6:24 AM

Answers

  • The .NET 2.0 SP1 compilers automatically turn DEP on.  vshost is not causing the problem, that's just the program that runs your .exe while debugging in the IDE.  Most likely, you are using an old ActiveX control or COM component that is violating DEP requirements.  Earlier versions of ATL dynamically create code in a data segment.  It might also be caused by some kind of shell extension handler or a "support" DLL that gets loaded into your program due to a SetWindowsHookEx() call.  Or something with a more sinister intention, exactly what DEP is designed to prevent.  Since it doesn't happen in a WF app, the latter scenario isn't that likely.

    You can turn DEP off but you're likely to get in trouble with your customer sooner or later.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Friday, July 25, 2008 11:10 AM
    Tuesday, July 22, 2008 2:27 AM
    Moderator

All replies

  • The .NET 2.0 SP1 compilers automatically turn DEP on.  vshost is not causing the problem, that's just the program that runs your .exe while debugging in the IDE.  Most likely, you are using an old ActiveX control or COM component that is violating DEP requirements.  Earlier versions of ATL dynamically create code in a data segment.  It might also be caused by some kind of shell extension handler or a "support" DLL that gets loaded into your program due to a SetWindowsHookEx() call.  Or something with a more sinister intention, exactly what DEP is designed to prevent.  Since it doesn't happen in a WF app, the latter scenario isn't that likely.

    You can turn DEP off but you're likely to get in trouble with your customer sooner or later.
    Hans Passant.
    • Marked as answer by Zhi-Xin Ye Friday, July 25, 2008 11:10 AM
    Tuesday, July 22, 2008 2:27 AM
    Moderator
  • I got a similar problem when closing WPF application using debug mode or .EXE file in Vista, but the error messages "vshost.exe has stopped working" or "xxx.exe has stopped working" don't pop-up if I run the WPF application as administrator. Is it a windows security problem of WPF application.  I also found there is another solution for that, we can publish the WPF application to generate a .application file (yourWPFapplicationname.application) and the error messages also disapper. But can we stop the error message without this solution?
    • Edited by Teren F Wednesday, August 6, 2008 2:53 PM WPF solution
    Wednesday, August 6, 2008 2:52 PM
  • I have had this problem, but the only time it occurs is if I have used Crystal Reports to print a document and then not closed and disposed of the Report before exiting the VS program
    Saturday, February 11, 2012 8:13 AM
  • Even i faced this problem while opening Crystal report from the application i created in VS2010.

    I think this is becaue of the unmanged code.

    I had Crystal Report 11 installed before. so i removed the Crystal Report 11 and installed Crystal Report for .net from the link below :

    http://www.businessobjects.com/jump/xi/crvs2010/us2_default.asp

    Also clean and build the application again (Remove and add all refernces of Crystal report again).

    This solved my problem :)


    • Edited by Deepali K Monday, February 27, 2012 8:59 AM
    Monday, February 27, 2012 8:59 AM