C# – Visual Studio 2008 would not debug

c

Im trying to debug the following code

using System;

public class Parent
{
    string parentString;
    public Parent()
    {
        Console.WriteLine("Parent Constructor.");
    }
    public Parent(string myString)
    {
        parentString = myString;
        Console.WriteLine(parentString);
    }
    public void print()
    {
        Console.WriteLine("I'm a Parent Class.");
    }
}

public class Child : Parent
{
    public Child()
        : base("From Derived")
    {
        Console.WriteLine("Child Constructor.");
    }
    public new void print()
    {
        base.print();
        Console.WriteLine("I'm a Child Class.");
    }
    public static void Main()
    {
        Child child = new Child();
        child.print();
        ((Parent)child).print();
    }
}

but the Console only flashes on the screen, the output window generates the following messages…

'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll' 'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Users\Skylight\Documents\Visual
Studio
2008\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll' 'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll' 'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll' 'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'
The thread 0x10c8 has exited with code
0 (0x0). The thread 0x924 has exited
with code 0 (0x0).
'ConsoleApplication1.vshost.exe'
(Managed): Loaded
'C:\Users\Skylight\Documents\Visual
Studio
2008\Projects\ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.exe',
Symbols loaded. The thread 0x954 has
exited with code 0 (0x0). The thread
0xd84 has exited with code 0 (0x0).
The program '[3660]
ConsoleApplication1.vshost.exe:
Managed' has exited with code 0 (0x0).

Best Answer

Number of problems can cause this:

  1. Did you set a breakpoint or start with [F11] (step into) ?
  2. build in debug mode
Related Topic