DXWIN0005: A Form Dialog is Never Disposed
Severity: Warning
Any Form displayed as a dialog (with the System.Windows.Forms.Form.ShowDialog
method) must be disposed when not needed anymore. Otherwise, it may cause memory leaks.
Invalid Code
Form dialog1 = new Form();
dialog1.ShowDialog();
Valid Code
using (Form dialog1 = new Form()) {
dialog1.ShowDialog();
}
// or
Form dialog1 = new Form();
dialog1.ShowDialog();
dialog1.Dispose();