Why is destructor for a form called twice?
问题 This code with entry point calls form's destructor twice. void Main(array<String^>^ args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); MyApp::MyForm form; Application::Run(%form); } I have changed it to void Main(array<String^>^ args) { Application::EnableVisualStyles(); Application::SetCompatibleTextRenderingDefault(false); Application::Run(gcnew MyApp::MyForm); } The second version calls destructor one time only. Why initially was it called