question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

WinForms application is not rendered when debugging a test

See original GitHub issue

Having a test like:

[Test]
public void Test()
{
    Application.Run(new Form());
}

works fine when run without debugging (form is visible) however when run with debugging, the form is not visible.

Possibly related to: https://github.com/nunit/nunit3-vs-adapter/pull/42 ?

  • NUnit: v3.12
  • NUnit3TestAdapter: v3.13
  • Visual Studio 2017 Professional (15.9.5)
  • .NET Framework 4.6.2

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jnm2commented, Jun 17, 2019

Fyi @OsirisTerje, I reproduced this with the project I had open in VS (16.1)

0reactions
christianjunkcommented, Jan 15, 2020

@christianjunk Thanks! That makes sense! Do you mean it worked as it should with adding that? If so, it’s a good workaround.

@OsirisTerje This solution worked for me as expected. According to NUnit3 I have edited my answer and added the following line:

[Test, Apartment(ApartmentState.STA)]

https://github.com/nunit/docs/wiki/Apartment-Attribute

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Windows Form Won't Display in Debug Mode
I make it to the 'initForm.ShowDialog()' line of code. It runs that line of code but then nothing happens. I don't receive any...
Read more >
Walkthrough: Debug a Windows Form - Visual Studio
Follow a walkthrough to see how to create and debug a Windows Form, a common managed application. You can use C#, Visual Basic,...
Read more >
Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >
Windows Forms application working in Release but not in ...
In this solution, the error occurs in both the Release and Debug configurations. ... As a last test, I cloned the solution manually....
Read more >
Design Windows Forms | JetBrains Rider Documentation
If your project includes Windows Forms, you can use JetBrains Rider's visual Windows Forms designer and also create new Windows Forms ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found