3

My tests run all the way through on the command line (using dotnet.exe test), but when running them within Test Explorer in Visual Studio 2017, some of the tests are crashing. Due to notes I have from prior debugging efforts, one particular test crashes with an out of memory exception (I had to reduce the scope of the test in order to prevent it from crashing).

I am testing on .NET Framework 4.5.1, .NET Core 1.0, and .NET Core 2.0 (the current scenario is on .NET Core 1.0).

What I am wondering is if there is an official way to increase the heap size of Test Explorer in Visual Studio 2017?

NOTE: Ideally, I'd like to put together a command or configuration that is automated so that anyone who clones my repo and runs tests in Visual Studio 2017+ will have the increased heap size.

What I Tried

I discovered this article that explains how to do increase memory, but it is meant for increasing the size of an EXE that you are developing, not for testing. I followed the instructions to use the editbin.exe utility to try to increase C:\Program Files\dotnet\dotnet.exe, but this didn't seem to have any effect (the test still crashes).

4
  • Possible duplicate of Heap size in C# / .Net Framework - Can it grow and how? Commented Aug 29, 2017 at 17:19
  • Is your test running in a 32 or 64 bit environment? test explorer may launch it in 32bit which limits your heap. Commented Aug 29, 2017 at 17:38
  • @MartinUllrich - Good point. I have been testing under x86 in Visual Studio. I will give x64 a try. Commented Aug 29, 2017 at 18:13
  • @MartinUllrich - That did the trick. Please add your comment as an answer and I will accept it. And probably should note that the setting is under Test > Test Settings > Default Processor Architecture > X64, since it is difficult to find if you don't know where to look. Commented Aug 29, 2017 at 19:04

1 Answer 1

3

This can happen when your tests are run in a 32bit host which limits your available memory.

The VS-integrated test explorer can run both in 32 and 64 bit mode, with 32 usually being the default. This can be easily changed through the menu Test > Test Settings > Default Processor Architecture menu:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.