0

I'm using OpenCover to report on my code coverage for my NUnit tests, and when I run a suite of tests which take a long time I get the following exception:

An exception occured: The number of WaitHandles must be less than or equal to 64.
stack:    at System.Threading.WaitHandle.WaitAny(WaitHandle[] waitHandles, Int32 millisecondsTimeout, Boolean exitContext)
   at OpenCover.Framework.Manager.ProfilerManager.ProcessMessages(List`1 handles, GCHandle pinnedComms)
   at OpenCover.Framework.Manager.ProfilerManager.RunProcess(Action`1 process, Boolean isService)
   at OpenCover.Console.Program.Main(String[] args)

This only happens when I replace my mock DAL with a real DAL in my tests. Basically I'm running the same set of tests against the same interfaces, just with an integrated implementation instead of a mock implementation. The mock DAL tests run fine, another DAL implementation which uses XML files runs fine (just expectedly slower). The slowest of the three, the actual SQL implementation (slow because of the teardown/setup between each test), brings about this error.

There's no shortage of information online about threading and WaitHandles for custom code, but this is happening inside of a 3rd party tool. Is there something I can do with OpenCover to fix this? Some command line argument which explicitly directs the threading to allow these long-running tests? Perhaps an argument that it needs to pass to NUnit?

David
  • 208,112
  • 36
  • 198
  • 279
  • Interesting... I just ran the tests on a new machine and the error didn't happen. Took 2007.9 seconds, which is fine. But no error. – David Nov 20 '12 at 15:31
  • Interesting - there should be only a single wait handle per process - perhaps too many processes were talking to opencover – Shaun Wilde Jan 03 '13 at 02:37

0 Answers0