This is really just a note for future reference and to help anyone else experiencing this issue:
C# projects with hundreds of unit tests (more than a thousand or so) having unit tests failing randomly with the following error:
The system could not find the environment option that was entered
Not enough storage is available to process this command
I battled to find the solution but this KB from Microsoft solved the problem:
Essentially it involved the following (from the article in case the link goes dead at some point):
The IRPStackSize parameter specifies the number of stack locations in I/O request packets (IRPs) that are used by Windows 2000 Server, by Windows Server 2003, and by Windows XP. You may have to increase this number for certain transports, for media access control (MAC) drivers, or for file system drivers. Each stack uses 36 bytes of memory for each receive buffer. This value is set in the following registry subkey:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters
The default value of the IRPStackSize parameter is 15. The range is from 11 (0xb hexadecimal) through 50 (0x32 hexadecimal).
If the subkey is not present, you can use Registry Editor to add the subkey. To do this, follow these steps:
- Click Start, click Run, type regedit, and then click OK.
- Locate and then click the following registry subkey:
- Click Edit, point to New, and then click DWORD Value.
- Type IRPStackSize, and then press ENTER to name the value.Note Type IRPStackSize exactly as it is displayed. The value name is case sensitive.
- Click Edit, and then click Modify.
- In the Data Value box, type the value that is appropriate for the network, and then click OK.
Hope this proves useful to someone in the future, sure took me a long time to find the solution.
One thought on “Errors when running large numbers of unit tests via mstest on a windows server (just a note really)”
We didn’t have quiet that many test but very quickly switched to NUnit over MSTest. The language or “phrasing” seemed more natural and with the resharper NUnit support it all worked out well 🙂