如何增加在Visual Studio 2017中运行.NET Core 1.x / 2.x测试的堆大小?

编程入门 行业动态 更新时间:2024-10-19 17:35:19
本文介绍了如何增加在Visual Studio 2017中运行.NET Core 1.x / 2.x测试的堆大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我的测试在命令行中一直运行(使用 dotnet.exe测试),但是在Visual Studio 2017的测试资源管理器中运行它们时,测试崩溃了。由于我之前的调试工作注意到,一个特定的测试会因内存不足异常而崩溃(我不得不缩小测试范围以防止崩溃)。

我正在.NET Framework 4.5.1,.NET Core 1.0和.NET Core 2.0(目前的情况是.NET Core 1.0)上进行测试。

我想知道的是,是否存在增加Visual Studio 2017中Test Explorer堆大小的官方方法?

注意:理想情况下,我想将自动化的命令或配置放在一起,以便克隆我的存储库并在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?

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).

解决方案

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测试的堆大小?

本文发布于:2023-11-14 15:01:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1587664.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大小   测试   Studio   Visual   NET

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!