I just discovered unit test projects in Visual Studio .NET and am using test methods to set up examples of global code I have developed.
Some global methods involve
I had the same issue. The dialog was blinking visible then disappearing. It was already TopMost, and I tried the other trick of setting it to visible then not visible before showdialog was called, but nothing worked.
Then I checked the other dialog that was working fine and it had ControlBox = true. I tried that, and it worked!
This is definitely applicable to the question.
I finally had some consistent success (and lack thereof) based on a single form property: ShowInTaskbar.
When a form had that property set to true, such forms would NOT display from a unit test method. When that property is false, all forms display. So, here are the rules as far as I know them to make sure a form can display from a unit test:
This has let me display and test all of my utility forms like date selectors and login screens.