问题描述
我的测试一直在命令行上运行(使用 dotnet.exe test
),但是在 Visual Studio 2017 的测试资源管理器中运行它们时,一些测试崩溃了.根据我之前调试工作的记录,一个特定的测试因内存不足异常而崩溃(我不得不缩小测试范围以防止它崩溃).
我正在 .NET Framework 4.5.1、.NET Core 1.0 和 .NET Core 2.0 上进行测试(当前场景是在 .NET Core 1.0 上).
我想知道是否有官方方法可以增加 Visual Studio 2017 中测试资源管理器的堆大小?
注意:理想情况下,我想将自动化的命令或配置放在一起,以便任何克隆我的存储库并在 Visual Studio 2017+ 中运行测试的人都将拥有增加的堆大小.
我的尝试
我发现了
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?
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 Filesdotnetdotnet.exe
, but this didn't seem to have any effect (the test still crashes).
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:
这篇关于如何增加堆大小以在 Visual Studio 2017 中运行 .NET Core 1.x/2.x 测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!