Hi,
I'm in the process of getting NCrunch working in a codebase for the first time. The unit test projects work nicely. I am trying to get the integration tests working now, but I need to be able to override NUnit parallelization settings for the integration test projects (specifically [assembly: Parallelizable(ParallelScope.Fixtures)] and [assembly: LevelOfParallelism(8)])
I am unfortunately not being allowed to use conditional compilation. I can see that runsettings files are not supported. Is there another way (e.g. custom build properties) that I can override the NUnit settings?
Remco NCrunch Developer
#18883
15 Aug 2026 00:53 UTC
Hi, thanks for sharing this.
NCrunch sets 'NumberOfWorkers = 1' in NUnit parameters, which (from my understanding) is supposed to remove NUnit parallelization regardless of the attributes you've specified.
Can you confirm that temporarily removing these attributes allows your tests to pass under NCrunch? My suspicion is that there may be more to this problem.
NCrunch sets 'NumberOfWorkers = 1' in NUnit parameters, which (from my understanding) is supposed to remove NUnit parallelization regardless of the attributes you've specified.
Can you confirm that temporarily removing these attributes allows your tests to pass under NCrunch? My suspicion is that there may be more to this problem.
Hi Remco,
Thanks for replying so quickly.
Removing the attributes (using conditional compilation) gets all the tests passing, and also removes the warning about instability. With the attributes in place I get a small number of tests failing, and of course all the NCrunch warnings.
If I set Max number of processing threads > 1, is that going to have an effect here? I will check on this, at my first opportunity on Monday.
Thanks for replying so quickly.
Removing the attributes (using conditional compilation) gets all the tests passing, and also removes the warning about instability. With the attributes in place I get a small number of tests failing, and of course all the NCrunch warnings.
If I set Max number of processing threads > 1, is that going to have an effect here? I will check on this, at my first opportunity on Monday.
Remco NCrunch Developer
#18885
15 Aug 2026 07:23 UTC
It's worth checking to see whether disabling parallel execution in NCrunch (via config setting) has any effect on this problem. It may be that the tests themselves are intermittently failing due to shared use of an external resource, so running them with Churn Mode might be useful to determine whether the failures are consistent. Setting the max number of processing threads to 1 is basically the same as disabling parallel execution on NCrunch.
Remco NCrunch Developer
#18886
15 Aug 2026 13:14 UTC
I've done some more digging and confirmed that, unfortunately, when parallel attributes are in place, NCrunch cannot stop NUnit from using parallel features.
This is a situation where no NCrunch configuration setting can save you. Somewhere you'll need to have actual logic in your code that changes the behaviour to disable NUnit Parallelization under NCrunch. Is it possible you're avoiding use of the compiler conditions to avoid introducing NCrunch-specific workarounds into a shared codebase? If so, I'm wondering if the easiest option might just be to add the condition and avoid committing this particular source file to avoid affecting other members of your team. Not ideal, but I'm struggling to suggest any other options right now.
This is a situation where no NCrunch configuration setting can save you. Somewhere you'll need to have actual logic in your code that changes the behaviour to disable NUnit Parallelization under NCrunch. Is it possible you're avoiding use of the compiler conditions to avoid introducing NCrunch-specific workarounds into a shared codebase? If so, I'm wondering if the easiest option might just be to add the condition and avoid committing this particular source file to avoid affecting other members of your team. Not ideal, but I'm struggling to suggest any other options right now.
Hi Remco,
Thanks for your extra efforts here.
I might be able to move the parallelization settings to runsettings files for the integration tests, which should result in them being ignored by NCrunch.
I will also investigate the failing tests closely. As I have only a small number of failing tests out of several thousand, there is probably something specific about those tests which is effecting them.
Thanks for your extra efforts here.
I might be able to move the parallelization settings to runsettings files for the integration tests, which should result in them being ignored by NCrunch.
I will also investigate the failing tests closely. As I have only a small number of failing tests out of several thousand, there is probably something specific about those tests which is effecting them.
Post a reply
Log in to reply.