简体   繁体   English

如何确定导致测试资源管理器崩溃的异常?

[英]How do I determine what exception caused Test Explorer to crash?

When I ran tests in prior versions of Visual Studio Test Explorer and there was a problem that caused the build runner to crash (such as AccessViolationException , StackOverflowException , OutOfMemoryException , etc), it would output a message displaying the exception type thrown and how to enable a log to get more details. 当我在Visual Studio Test Explorer的早期版本中运行测试并且存在导致构建运行器崩溃的问题(例如AccessViolationExceptionStackOverflowExceptionOutOfMemoryException等)时,它将输出一条消息,显示抛出的异常类型以及如何启用获取更多详细信息的日志。

With Visual Studio 2017 Community Edition version 15.3.2 and .NET Core 1.0, when there is a crash all that is shown in the Test Output is: 使用Visual Studio 2017社区版15.3.2和.NET Core 1.0,当发生崩溃时,测试输出中显示的是:

[8/30/2017 3:03:42 AM Error] The active Tests Run was aborted. [8/30/2017 3:03:42 AM错误]活动的测试运行中止。

[8/30/2017 3:03:42 AM Informational] ========== Run test finished: 1030 run (0:41:12.5762484) ========== [8/30/2017 3:03:42 AM信息] ==========运行测试完成:1030运行(0:41:12.5762484)==========

How can I determine what type of exception caused the build runner to crash (preferably with a stack trace)? 如何确定导致构建运行器崩溃的异常类型(最好是使用堆栈跟踪)?

NOTE: I have opened an issue with NUnit during this investigation asking about how to determine which tests are causing the crash. 注:我已经打开了一个与NUnit的问题,本次调查询问如何确定哪些测试导致崩溃时。 I have already isolated (and worked around) 2 of the causes. 我已经孤立(并解决)了两个原因。

  1. .NET Core 2.0 crashes fatally when a Debug.Assert fails Debug.Assert失败时,.NET Core 2.0会崩溃
  2. The test runner was running out of virtual memory due to running under 32 bit. 由于在32位下运行,测试运行器的虚拟内存不足。

But there is still at least one more issue causing a crash. 但仍有至少一个问题导致崩溃。 I am trying to work out why the test runner crashes in Visual Studio 2017 but does not crash on the command line. 我试图弄清楚为什么测试运行程序在Visual Studio 2017中崩溃但在命令行上没有崩溃。

Also note that this particular crash does not happen when running on .NET Framework, so suggestions to use command line tools that don't support .NET Core 1.0 or .NET Core 2.0 (such as vstest.console.exe ) are not helpful. 另请注意,在.NET Framework上运行时不会发生此特定崩溃,因此使用不支持.NET Core 1.0或.NET Core 2.0的命令行工具(例如vstest.console.exe )的建议没有帮助。

This have been several reported issues similar to this. 这有几个与此类似的报道问题。 It appears to be a bug with the Entity Framework Core that hasn't been fixed yet. 它似乎是实体框架核心的一个尚未修复的错误。 It was also a problem in the .NET Core command-line (CLI) that's been fixed. 这也是已修复的.NET Core命令行(CLI)中的一个问题。

Open issue 公开问题

SqlLite.FunctionalTests sometimes fail on Ubuntu #8642 also has the same issue, different app type, but same issue. SqlLite.FunctionalTests有时在Ubuntu上失败#8642也有相同的问题,不同的应用类型,但同样的问题。 The OP is also having difficulty finding a trace of the error. OP也难以找到错误的痕迹。

The active test run was aborted. Reason: 
null

The current open one has been marked as blocked: 当前打开的一个已标记为已阻止:

Discussed again in triage and decided that we need to get more info from the test runner. 在分类中再次讨论并决定我们需要从测试运行器获得更多信息。 Commented on Microsoft/vstest#527 asking for more info. 评论微软/ vstest#527要求更多信息。 Marking as blocked for now until we get some info from the vstest team. 现在标记为阻止,直到我们从vstest团队获得一些信息。

Closed on 22 Jun 6月22日关闭

There is a The reason why the test run was aborted is not indicated. 有一个没有说明测试运行中止的原因。 #527 #527
which was marked as a duplicate of: 被标记为重复:
Show the test which crashed the test run (test explorer) #627 显示崩溃测试运行的测试(测试资源管理器)#627

The solutions being 解决方案是

This is fixed in latest dev builds of dotnet-cli 2.0.0-preview1-005963. 这在dotnet-cli 2.0.0-preview1-005963的最新开发版本中得到修复。 Download it from https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-dev-win-x64.latest.zip . https://dotnetcli.blob.core.windows.net/dotnet/Sdk/release/2.0.0/dotnet-dev-win-x64.latest.zip下载。

We have also fixed it for VS. 我们还为VS修了它。 Will update when a build with fix is available. 将在具有修复的构建可用时更新。

Note: issue will show for netcoreapp2.0 due to dotnet/cli#6535 . 注意:由于dotnet / cli#6535,将显示netcoreapp2.0的问题。

And

.../ fix is available in VS15.3.0 preview2. ... / fix在VS15.3.0 preview2中可用。

How to get logs of the crash 如何获取崩溃的日志

Apart from ensuring you've enable diagnostics (which I'm sure you have), or running it on a console. 除了确保您启用诊断(我确定您有),或在控制台上运行它。

A comment from the github issue Show the test which crashed the test run (test explorer) #627 来自github问题的评论 显示测试运行崩溃的测试(测试资源管理器)#627

Can you enable --diag:log.txt switch to get more logs and analyze log.txt and log.*.host.txt for more details? 您是否可以启用--diag:log.txt开关来获取更多日志并分析log.txt和log。*。host.txt以获取更多详细信息?

Closed as no repro 关闭没有repro

No explanation of aborting test when a static constructor throws exception. 当静态构造函数抛出异常时,没有解释中止测试。 #334 reported the same issues: #334报告了同样的问题:

The active test run was aborted. Reason:

No reason. 没理由。

It was closed as no repro. 它被关闭,因为没有repro。


To address the need to run the nunit tests on the main thread Running unit tests with a main loop . 解决在主线程上运行 nunit测试的需要使用主循环运行单元测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何获取自定义异常以显示导致异常的输入? - How do I get my custom exception to show what input caused the exception? 什么是,如何通过绘制矩形确定这种奇怪异常的原因? - What is, and how do I determine the cause of this strange exception with drawing a Rectangle? 如果从Microsoft的代码中抛出异常,我如何找出最初导致异常的内容? - How do I find out what originally caused an exception, if it gets thrown from Microsoft's code? 如何确定名称空间所在的程序集? - How do I determine what assembly a namespace is in? 如何确定哪个参数集导致测试失败? - How to determine which parameter set caused the test to fail? 如何为此测试生成异常? - How do I generate an Exception for this test? 序列化JSON时:如何确定导致InvalidCastException的原因? - When serializing JSON: how to determine what caused InvalidCastException? 捕获 C# IOException 时,如何知道导致异常的文件? - When catching C# IOException, how can I know what file caused the exception? 如何在visual studio test explorer中显示自定义异常消息 - How can I show a custom exception message in visual studio test explorer 我如何确定哪个dropdownlistfor在mvc3中引起回发? - how can i determine which dropdownlistfor caused postback in mvc3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM