且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 localdb 进行 NUnit 测试期间的 System.OutOfMemoryException

更新时间:2023-02-14 14:32:32

找到了解决方法.我们跟踪分配给我们为每个需要种子的测试创建的 localdb 实例的内存.这些实例以测试用例命名.当我们将它们全部重命名为相同的名称并按顺序运行测试(因此测试不会相互干扰)时,只为单个实例分配了内存.

Found a workaround. We tracked the memory being allocated to the localdb instances we created for every test we needed a seed for. These instances were named after the test cases. When we renamed all of them to the same name and ran the tests sequentially (so the tests didn't interfere with each other) memory was only allocated for a single instance.