nunit-console: System.OutOfMemoryException running NET6 unit testing with Console.Runner 3.16.3

I’m running approximately 2600 unit tests for my custom control in both NetFramework 4.7.2 and NET6 via TeamCity. With net472, all works fine.

However, I encountered issues with net6. Initially, I tried using Console runner 3.16.2, but I received the error System.NotSupportedException: Cannot read resources that depend on serialization. This error can also be reproduced when running tests on my local machine. image

I then attempted to use the latest version, v3.16.3, and it seemed to work fine until I encountered an OutOfMemoryException after approximately 10 minutes (it does not crash always with the same test). image

When running the single test, it succeeds, but running all the tests on my local machine gives the System.Net.Sockets.SocketException instead (the same described here) image

The command line used is: "C:\Users\xxx\.nuget\packages\nunit.consolerunner\3.16.3\tools\nunit3-console.exe" UnitTesting.dll --where cat!=Wpf --labels=BeforeAndAfter --trace=Error

Unfortunately, I can’t run with the --inprocess flag due to the reasons explained here.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 17 (8 by maintainers)

Most upvoted comments

@OsirisTerje I’ve managed to identify the cause behind the out-of-memory issue. It turns out to be a known bug in .NET6, which has already been documented here.

P.S. If you could spare a moment, your upvote on the issue would be greatly appreciated as well. Thank you! 😃

@OsirisTerje Support for Windows Forms was one of the things added in the 3.16 series. I think you may need to merge changes made in 3.15 and 3.16 into a new release.