Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wpf VS调试器未关闭_Wpf_C# 4.0 - Fatal编程技术网

Wpf VS调试器未关闭

Wpf VS调试器未关闭,wpf,c#-4.0,Wpf,C# 4.0,我有以下代码。谁能告诉我ut、c2实例会发生什么情况?他们会在附近闲逛很长一段时间而不被垃圾收集吗?我询问的原因是,在关闭所有窗口(包括执行此代码的窗口)后,Visual Studio调试器仍处于打开状态(我正在调试模式下运行它)。 如果我没有在类2中的Initializer()方法中引发异常,则在我关闭所有窗口后,调试器将关闭 下面是代码 namespace Test { public class Class1 { private ICommand testCommand;

我有以下代码。谁能告诉我ut、c2实例会发生什么情况?他们会在附近闲逛很长一段时间而不被垃圾收集吗?我询问的原因是,在关闭所有窗口(包括执行此代码的窗口)后,Visual Studio调试器仍处于打开状态(我正在调试模式下运行它)。 如果我没有在类2中的Initializer()方法中引发异常,则在我关闭所有窗口后,调试器将关闭

下面是代码

namespace Test
{
  public class Class1
  {

    private ICommand testCommand; 
    public ICommand TestCommand
    {
      get
      {
        return updCommand ?? (updCommand = new DelegateCommand(() =>
        {
          int nStatus = 0;
          Class2 c2 = new Class2();
          nStatus = c2.InitStatus;
          if (nStatus == 0)
          {
            c2.doSth()
          }
          System.Windows.MessageBox.Show("Return status = " + nStatus.ToString());
          c2 = null;
        }
        ));
      }
    }
  }

  public class Class2
  {
    Utilities ut = new Utilities();
    public int InitStatus { get; set; }

    public Dbupdate()
    {
      Initializer();
    }
    private void Initializer()
    {
      try
      {
        throw new Exception("just test");
      }
      catch (Exception ex) { ErrHandler("Initializer(): " + ex.Message); InitStatus = -100; }
    }

    private void doSth()
    {
      ut.doWhateve();
    }
  }
}

我明白了。我实例化了一个窗口,但在引发异常之前没有关闭。

应用程序的Application.ShutdownMode是什么?我在哪里查找应用程序的Application.ShutdownMode?它没有在app.xaml中定义,因此它必须是默认的OnLastWindowClose。