It does for C# (see code below) but not for C++.
using System;
class Test
{
Test()
{
throw new Exception();
}
~Test()
{
Console.WriteLine("Finalized");
}
static void Main()
{
try
{
new Test();
}
catch {}
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
This prints "Finalized"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…