簡體   English   中英

Visual Studio 2008不會調試

[英]Visual Studio 2008 would not debug

我試圖調試以下代碼

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();
    }
}

但是控制台只在屏幕上閃爍,輸出窗口會生成以下消息......

'ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_32 \\ mscorlib \\ 2.0.0.0__b77a5c561934e089 \\ mscorlib.dll''ConsoleApplication1.vshost.exe'(已管理):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ Microsoft.VisualStudio.HostingProcess.Utilities \\ 9.0.0.0__b03f5f7f11d50a3a \\ Microsoft.VisualStudio.HostingProcess.Utilities.dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ System.Windows.Forms \\ 2.0.0.0__b77a5c561934e089 \\ System.Windows.Forms.dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ System \\ 2.0.0.0__b77a5c561934e089 \\ System。 dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ System.Drawing \\ 2.0.0.0__b03f5f7f11d50a3a \\ System.Drawing.dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ Microsoft.VisualStudio.HostingProcess.Utilities.Sync \\ 9.0.0.0__b03f5f7f11d50a3a \\ Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll''ConsoleApplication1.vsh ost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ Microsoft.VisualStudio.Debugger.Runtime \\ 9.0.0.0__b03f5f7f11d50a3a \\ Microsoft.VisualStudio.Debugger.Runtime.dll''ConsoleApplication1.vshost.exe'(托管):加載'C:\\ Users \\ Skylight \\ Documents \\ Visual Studio 2008 \\ Projects \\ ConsoleApplication1 \\ ConsoleApplication1 \\ bin \\ Debug \\ ConsoleApplication1.vshost.exe''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ System.Core \\ 3.5.0.0__b77a5c561934e089 \\ System.Core.dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ System.Xml.Linq \\ 3.5 .0.0__b77a5c561934e089 \\ System.Xml.Linq.dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_MSIL \\ System.Data.DataSetExtensions \\ 3.5.0.0__b77a5c561934e089 \\ System.Data.DataSetExtensions .dll''ConsoleApplication1.vshost.exe'(Managed):已加載'C:\\ Windows \\ assembly \\ GAC_32 \\ System.Data \\ 2.0.0.0__b77a5c561934e089 \\ System.Data.dll''ConsoleApplication1.vshost.exe'(已管理) :加載'C:\\ W indows \\ assembly \\ GAC_MSIL \\ System.Xml \\ 2.0.0.0__b77a5c561934e089 \\ System.Xml.dll'線程0x10c8已退出,代碼為0(0x0)。 線程0x924已退出,代碼為0(0x0)。 'ConsoleApplication1.vshost.exe'(已管理):已加載'C:\\ Users \\ Skylight \\ Documents \\ Visual Studio 2008 \\ Projects \\ ConsoleApplication1 \\ ConsoleApplication1 \\ bin \\ Debug \\ ConsoleApplication1.exe',已加載符號。 線程0x954已退出,代碼為0(0x0)。 線程0xd84已退出,代碼為0(0x0)。 程序'[3660] ConsoleApplication1.vshost.exe:Managed'已退出,代碼為0(0x0)。

問題數量可能導致此問題:

  1. 您是否設置了斷點或以[F11]開始(步入)?
  2. 在調試模式下構建

如果你想讓控制台熬夜,那就放一個......

Console.ReadLine();

...作為您主要的最后一行。 它會一直打開,直到你回來。 (這對我來說看起來像是一個小測試程序,所以我認為這沒關系。)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM