I have faced issue with the rule EnsureLocalDisposalRule when my code is incompatible with the rule.
Example of code:
Form myForm = new myForm { MdiParent = this };
myForm .Show();
It is brakes the rule and I corrected it like this
Example of code:
using (Form myForm = new myForm { MdiParent = this })
{
myForm .Show();
}
But I have problem with my working code because after the above correction my WinForm object
is destroyed right away.
How to fix the rule and get the code working?