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