如何在使用VS Test运行的单元测试中找出System.AppDomainUnloadedException的原因 [英] How to track down the cause for System.AppDomainUnloadedException in Unit Tests run with VS Test

查看:48
本文介绍了如何在使用VS Test运行的单元测试中找出System.AppDomainUnloadedException的原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近从TFS/VS 2010升级到TFS/VS 2013,通过Tam Build运行单元测试时,开始看到以下警告的大约15倍.

We recently upgraded from TFS/VS 2010 to TFS/VS 2013 and begin to see about 15 times the following warning when running our unit test through Tam Build.

System.AppDomainUnloadedException:
尝试访问已卸载的AppDomain.如果测试
,可能会发生这种情况 启动了一个线程,但没有停止它.确保所有线程均由
启动 测试在完成之前已停止.

System.AppDomainUnloadedException:
Attempted to access an unloaded AppDomain. This can happen if the test(s)
started a thread but did not stop it. Make sure that all the threads started by
the test(s) are stopped before completion.

该警告并不能帮助我准确地找出问题所在(我有大约100个测试项目要经过).所以我的问题是,是否有一些聪明的调试/跟踪方法,以便我可以找出哪些未关闭的线程.

The warning does not help me much in pinpointing where the problem is (I have about 100 test projects to go through). So my question is if there is some clever way of debugging/tracing so that I can find out what threads that are not closed.

我从下面的Connect条目知道,我可以通过MSTest运行测试,但该测试会收到警告,但我想修复它们.

I know from the following Connect entry that I can run the tests through MSTest which eats the warning, but I would rather like to fix them.

http ://connect.microsoft.com/VisualStudio/feedback/details/797525/unexplained-appdomainunloadedexception-when-running-a-unit-test-on-tfs-build-server

撕裂Østergaard
丹麦Oticon A/S

Tore Østergaard
Oticon A/S, Denmark

推荐答案

Hi 2re,

Hi 2re,

对不起,您正在获得这种经验.我真的可以理解,您希望Microsoft解决此问题.但微软产品团队表示,这种情况是设计与vs测试运行程序有关的,并向我们解释了详细的原因:

Sorry that you are getting this experience. And I really can understand you want Microsoft to fix this situation. But Microsoft product team said this situation is by design for vs test runner and explained the detailed reason to us:

>在旧的MSTest运行程序中,我们吞没了所有异常,因此未在构建日志中显示.
在新的运行程序中,由于提供了运行其他框架测试的可扩展性支持,我们希望冒充警告之类的不一致之处.

In the old MSTest runner we were swallowing all exceptions and hence this was not showing up on the build log.
In the new runner, given the extensibility support for running other framework tests, we wanted to bubble up such inconsistencies as Warnings.

我认为Microsoft无法解决这种情况.实际上,MSTest和VS Test Runner都可以在TFS构建过程中很好地运行测试,您可以使用MSTest.

I think that Microsoft won’t fix this situation. Actually both MSTest and VS Test Runner can run tests fine in TFS build process, you can use MSTest.

感谢您的理解.

Thank you for your understanding.

最诚挚的问候

Best regards,


这篇关于如何在使用VS Test运行的单元测试中找出System.AppDomainUnloadedException的原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆