none
debugging application - vshost32.exe stop working RRS feed

  • Question

  • Hello,
    I'm trying to debug one of my application. But when my application crashes, VS doesn't break the application to see the code, it only shows dialog box with message that vshost32.exe has stopped working. In Visual Studio properties, "Enable just my code" is checked. In menu Debug - Exceptions all exceptions have "User - unhandled" checked. When I tried to check "Thrown" it works, but it breaks all the time (even if I catch the exception) - so I don't want to have "Thrown" checked.

    In some project it works, but in my current project doesn't. In properties of this project I have only "Enable the VS hosting process" checked. Can you help what is wrong? I'm using VS 2008 and the project is C# in .NET 3.5.

    thank you

    edit: I tried to debug this project on my friend's pc and it works good. So it should be an error in my settings of VS. Any ideas?

    Friday, April 30, 2010 7:37 AM

All replies

  • So, your application is started standalone? I meaning the application is not started from Visual Studio IDE.

    Is it a native application? did you try to set JIT for both Managed and Native? Tools->Options->Debugging->Just-In-Time Debugging.


    Sincerely,
    Eric
    Friday, April 30, 2010 9:35 AM
  • Hi Eric,
    I started it directly from VS IDE in debug mode like every other projects (press F5). But in this project, it doesn't break on unhandled exceptions, it only shows the dialog about vschost32.exe. Until I check "Thrown" in Debug - Exceptions as I wrote before.

    This application is managed only and I checked settings "Tools->Options->Debugging->Just-In-Time Debugging" and everything was checked.

    thank you

    Friday, April 30, 2010 10:01 AM
  • I would try to uncheck "Enable the VS hosting process" and run under debugger again.
    If the behavior is still the same, then it is possible that your (C#?) application causes a native exception (either from its native parts or from invalid PInvoke, etc.). In that case I guess you will have to attach native/mixed-mode debugger (I am not sure how to set it up in VS, but I am certain it is possible).

    -Karel

    Friday, April 30, 2010 4:12 PM
    Moderator
  • Hi Karel Zikmund,

    i made a big research. First I tried to put some Exceptions everywhere in my application. It is an application to drawing something. One control shows the graphical objects. When I wrote an Exception to LButtonDown event of drawing control - there was vschost dialog. Then I tried to write an Exception to menu item of the main form - vschost.

    Then I tried to create another solution and put the same project into it. LButtonDown - vschost, menu item - breaks the application. Strange.

    Then I tried to migrate the project into VS 2010. Same results. But when I tried to change .NET framework to 4.0, it breaks the application allways. Well it looks like an error in my .NET 3.5 framework.

    I tried to uncheck "Enable the VS hosting process", but it was the same...

    bad luck because I need to use VS2008 with .NET 3.5. Should I try to reinstall the framework or any other ideas? thank you

    • Proposed as answer by Tatyanka Wednesday, November 7, 2012 12:00 PM
    Tuesday, May 4, 2010 6:06 AM
  • Did you try to uncheck that button and debug the application (in native debugger)? What exactly happens? Paste the call stack. (If you see just a crash, it means that you don't have native debugger attached)

    -Karel

    Tuesday, May 4, 2010 3:49 PM
    Moderator
  • Well, i don't know if I mean the same button as you. But I tried to uncheck the "Enable the VS hosting process" it was the same - doesn't break the application and another dialog box. The behavior looks exactly like this:

    1. Start the application from VS 2008 IDE in debug mode.

    2. Do some action that cause Exception.

    3.1 "Enable the VS hosting process"is checked - it shows dialog box "vshost32.exe" - "vshost32.exe has stopped working". Some details (like problem event name, application name etc.) and three buttons. If I try to "Debug the program" there is a warning message "A debugger is attached to xxx.vshost.exe but not configured to debug this unhadled exception. To debug this exception, detach the current debugger". Then a dialog box "Visual Studio Just-in-Time Debugger" is shown.

    3.2 "Enable the VS hosting process"is unchecked - it shows the same dialog but not with "vshost32.exe" but with the name of the application. If I try to push Debug button, it is the same like in 3.1

    Wednesday, May 5, 2010 11:36 AM
  • In that case run your application from command line and attach (native) debugger to the process when it crashes. Then get the call stack(s).

    -Karel

    Wednesday, May 5, 2010 3:31 PM
    Moderator
  • When I attached debugger manually, the window with exception name and call stack appears - that is ok. But I really wonder why the application doesn't break during debugging from IDE...
    Thursday, May 6, 2010 5:42 AM
  • I can't say without seeing the call stack. My guess is that either you/VS did run managed debugger by default (and native crash happens before it fully starts or it just cannot deal with it) or there is another problem in the VS debugger.

    -Karel

    Thursday, May 6, 2010 5:53 AM
    Moderator
  • Sorry, I forgot to paste the call stack.

    there is an error in loading my file using serialization. but application doesn't break in other exception too as I wrote before...


    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.Runtime.Serialization.SerializationException: Cannot get the member 'pStation_OnAnchorMove'.
       at System.Reflection.MemberInfoSerializationHolder.GetRealObject(StreamingContext context)
       at System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHolder holder)
       at System.Runtime.Serialization.ObjectManager.DoFixups()
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
       at mycompany.mysolution.myapp.Drawing.cSchemaModel.LoadSchema(String szPath) in D:\mycompany\mycompany.mysolution\mycompany.mysolution.myapp.Drawing\cSchema.cs:line 96
       at mycompany.mysolution.myapp.Drawing.FormMain.m_menuMainFileOpenProject_Click(Object sender, EventArgs e) in D:\mycompany\mycompany.mysolution\mycompany.mysolution.myapp.Drawing\FormMain.cs:line 969
       at mycompany.mysolution.myapp.Drawing.FormMain.m_tsCommonProjectOpen_Click(Object sender, EventArgs e) in D:\mycompany\mycompany.mysolution\mycompany.mysolution.myapp.Drawing\FormMain.cs:line 668
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    SchemaDopravy
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///D:/mycompany/mycompany.mysolution/mycompany.mysolution.myapp.Drawing/bin/Debug/myapp.exe
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Core
        Assembly Version: 3.5.0.0
        Win32 Version: 3.5.30729.4926 built by: NetFXw7
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    System.Configuration
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
        CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    mycompany.mysolution.Common
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///D:/mycompany/mycompany.mysolution/mycompany.mysolution.myapp.Drawing/bin/Debug/mycompany.mysolution.Common.DLL
    ----------------------------------------
    mycompany.mysolution.Data.MyData
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///D:/mycompany/mycompany.mysolution/mycompany.mysolution.myapp.Drawing/bin/Debug/mycompany.mysolution.Data.MyData.DLL
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.


    Thursday, May 6, 2010 10:25 AM
  • any suggestions?
    Wednesday, May 19, 2010 8:17 AM
  • hi there,

    i had the same problem and i found solution. in project properties page on debug tab you just simply have to check option "enable unmanaged code debugging" i hope it will work for you.

    Thursday, May 20, 2010 11:46 AM
  • Your best tip.

    Thanks chrismu.

    Saturday, March 10, 2012 4:56 AM
  • Hi,

    Under project properties, please "enable unmanaged code debugging" and try .


    Regards, http://shwetamannjain.blogspot.com

    Saturday, March 10, 2012 10:26 AM
  • Hi

    I just have to run this program as administrator, and I have it alright. before, I have the same problem, and stuck there too. 

    Wednesday, October 29, 2014 12:45 AM
  • I have the same problem.

    By debugview, when start debugging, there is something strange.

        [12372]
        [12372]
        [12372] %s------------------------------------------------
        [12372]  ---          Themida Professional            ---
        [12372]  ---      (c)2012 Oreans Technologies         ---
        [12372]  ------------------------------------------------
        [12372]

    And in a clean pc, when start debugging, there is nothing.
    After I change platform target from x86 to x64, the log have not shown.
    So the question is that which program hooks all process and print the log.

    Wednesday, February 8, 2017 7:56 AM