0
我有一个C#项目,其中使用了托管C++类。 这个托管的C++类包装了一个非托管的C++代码。在VS 2010中调试时未调用析构函数
我有这样的代码块;
if (true)
{
ManagedFoo foo = new ManagedFoo();
}
//GC.Collect(); // I also tried with this one but result is same
我已经把一个简单的输出串类的析构函数。
如果我从Visual Studio运行程序,foo的析构函数不会被调用。 但是,如果我通过双击它(它是一个控制台应用程序)运行程序,立即调用 析构函数。
为什么它的行为如此呢?
非常感谢, 问候
重复从http://stackoverflow.com/questions/755680/gc-collect-doesnt-seem-to-work-in-debug-mode ? – nob 2010-08-26 08:25:36