T
tomj
I use CompactFramework 2.0.
The code generated by Designer does not invoke
InputPanel.Dispose when form is disposing. And
I cannot understand how it can work without
manual fixing.
Example:
using (Form2 form = new Form2())
{
form.ShowDialog();
}
// Form2 instance is disposed, but inputPanel1 is not
Now if I show or hide SIP in other forms, Form2.inputPanel1
will also get event EnabledChanged and it will lead to an error(
because the form it belongs is already disposed)
private void inputPanel1_EnabledChanged(object sender, EventArgs e)
{
//this code throw exception because form instance is disposed
this.Text = "Form2 " + inputPanel1.Enabled.ToString();
}
So, to fix the problem I need manually fix Designer code
protected override void Dispose(bool disposing)
{
// Bug fix
if (disposing)
{
inputPanel1.Dispose();
}
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
Is it a bug?
Thanks,
Tom.
The code generated by Designer does not invoke
InputPanel.Dispose when form is disposing. And
I cannot understand how it can work without
manual fixing.
Example:
using (Form2 form = new Form2())
{
form.ShowDialog();
}
// Form2 instance is disposed, but inputPanel1 is not
Now if I show or hide SIP in other forms, Form2.inputPanel1
will also get event EnabledChanged and it will lead to an error(
because the form it belongs is already disposed)
private void inputPanel1_EnabledChanged(object sender, EventArgs e)
{
//this code throw exception because form instance is disposed
this.Text = "Form2 " + inputPanel1.Enabled.ToString();
}
So, to fix the problem I need manually fix Designer code
protected override void Dispose(bool disposing)
{
// Bug fix
if (disposing)
{
inputPanel1.Dispose();
}
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
Is it a bug?
Thanks,
Tom.