【发布时间】:2020-11-16 22:58:17
【问题描述】:
我正在 MSTest 中运行一组测试,在特定测试完成并运行 TestCleanup 后发生异常,这会导致测试运行程序崩溃并且不再运行任何测试。我有五个测试可以做到这一点,它们看起来与一些正确运行的测试几乎相同。
这是输出测试窗口中的错误:
[11/16/2020 5:36:14 PM Informational] ------ Run test started ------
[11/16/2020 5:36:55 PM Error] An exception occurred while invoking executor 'executor://mstestadapter/v2': Object reference not set to an instance of an object.
[11/16/2020 5:36:59 PM Informational] ========== Run test finished: 0 run (0:00:45.5280936) ==========
这是我在“输出调试”窗口中看到的:
Exception thrown: 'System.NullReferenceException' in log4net.dll
Exception thrown: 'System.NullReferenceException' in Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
Exception thrown: 'System.NullReferenceException' in Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll
'testhost.x86.exe' (CLR v4.0.30319: Domain 3): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
…
The thread 0xdd68 has exited with code 0 (0x0).
Exception thrown: 'System.NullReferenceException' in Microsoft.TestPlatform.PlatformAbstractions.dll
The thread 0xdc80 has exited with code 0 (0x0).
The program '[57424] testhost.x86.exe' has exited with code 0 (0x0).
我可以看到 app.config 中的 log4net 设置为 OFF。导致测试运行程序崩溃的问题可能是什么?
【问题讨论】:
标签: log4net mstest nullreferenceexception