form.Hide() and form.Dispose() called out of order
Brought to you by:
charliepoole,
lukemaxon
In the .NET 2.0 Alpha 5 release NUnitFormTest.Verify()
includes the following section of code:
<<
foreach (Form form in allForms)
{
if (!KeepAlive(form))
{
form.Hide();
form.Dispose();
} //else branch not tested
}
>>
This results in the following exception when invoked:
<<
TearDown : System.Reflection.TargetInvocationException
: Exception has been thrown by the target of an invocation.
----> System.ObjectDisposedException : Cannot access
a disposed object.
>>
Simply reversing the order of form.Hide() and
form.Dispose() appears to fix the issue.
Logged In: YES
user_id=1320398
I added this bug - forgot to login first.
Logged In: YES
user_id=1636255
Originator: NO
I wonder if replacing both of these lines with "form.Close()" would be a better approach.