R
renegade_master_12121
Here is a Test.
formtest.cs:
class MyForm : System.Windows.Forms.Form {
void Dump(string s){
System.IO.StreamWriter sw = new
System.IO.StreamWriter("dumpfile.txt", true);
sw.WriteLine(s, System.DateTime.Now);
sw.Close();
}
public MyForm(){
Dump("ctor");
}
~MyForm(){
Dump("dtor");
}
}
class TestForm {
static void Main(){
MyForm x = new MyForm();
System.Windows.Forms.Application.Run(x);
}
}
This file defines a form and has a Main() which creates a form and
passes it to Application.Run(). However the destructor for the form
never seems to get called; the dumpfile.txt only ever mentions the
ctor call. What am I doing wrong or misunderstanding here? Thanks.
formtest.cs:
class MyForm : System.Windows.Forms.Form {
void Dump(string s){
System.IO.StreamWriter sw = new
System.IO.StreamWriter("dumpfile.txt", true);
sw.WriteLine(s, System.DateTime.Now);
sw.Close();
}
public MyForm(){
Dump("ctor");
}
~MyForm(){
Dump("dtor");
}
}
class TestForm {
static void Main(){
MyForm x = new MyForm();
System.Windows.Forms.Application.Run(x);
}
}
This file defines a form and has a Main() which creates a form and
passes it to Application.Run(). However the destructor for the form
never seems to get called; the dumpfile.txt only ever mentions the
ctor call. What am I doing wrong or misunderstanding here? Thanks.