无法加载 Visual Studio 2010 UnitTestAdapter

发布于 2024-09-18 08:34:08 字数 558 浏览 2 评论 0原文

我有几十个 VS 解决方案,每个解决方案都有一个我在工作和家里使用的 VS 测试项目。有一天,测试(在一种解决方案中)停止运行,当我运行测试时出现以下错误:

测试适配器 ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, 版本=10.0.0.0,文化=中立, 公钥令牌=b03f5f7f11d50a3a') 执行此测试所需的可以 不被加载。检查测试是否 适配器安装正确。目的 未设置对实例的引用 对象。

对于团队中的其他人来说,它仍然运行良好,对于我在工作中也运行良好,但家庭却是失败的。另外,其他解决方案的测试项目对我来说在家里都运行良好,只是其中之一失败了。另一个花絮是,我们在所有测试中都使用了 Moles(同样,其他 Moles 测试也运行良好)。

除了重建测试项目之外,我没有看到太多关于此错误的信息。我宁愿追根究底。

有什么想法吗?

I have a few dozen VS Solution, each with a a VS Test project in it that I use at work and at home. One day, the tests (in one solution) stopped running, giving me the following error when I run the tests:

The test adapter
('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter,
Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter,
Version=10.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a')
required to execute this test could
not be loaded. Check that the test
adapter is installed properly. Object
reference not set to an instance of an
object.

It continues to run fine for everyone else on the team, and fine for me at work, but home is a failure. Also, the other solutions' test projects all run fine for me at home, it is just one of them that fails. One other tidbit, we use Moles in all of the tests (again the other moles tests work fine).

I am not seeing much about this error, except for rebuilding the test project. I would rather get to the bottom of this.

Any thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

鹿港小镇 2024-09-25 08:34:08

我也有同样的问题。将我们的解决方案从 VS2008 转换为 VS2010 后开始出现问题。由于某种原因,在运行单元测试时,Visual Studio 抱怨无法找到 HostAdapter“Moles”。然后我尝试下载最新版本的Moles Framework(0.94.51023.0)并重新安装。

然后我收到了上面描述的问题。所有具有 HostType("Moles") 属性的测试均失败,并出现以下错误。

执行此测试所需的测试适配器('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')可以不被加载。检查测试适配器是否安装正确。你调用的对象是空的。

经过大量搜索后,我找到了问题的原因。
1) 我打开 Visual Studio 2010 命令提示符并输入 fuslogvw,这将启动程序集绑定日志查看器。
2)我进入“设置”并选中“记录所有绑定到磁盘”和“启用自定义日志路径”。
3)我开始了一项测试,该测试过去常常失败,并且日志查看器记录了很多文件。我打开了最新的日志文件,对我来说这个是:Microsoft.ExtendedReflection,Version=0.94.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35.HTM
4) 日志文件描述了 Visual Studio 如何尝试查找 Microsoft.ExtendedReflection.dll。但由于某种原因无法找到该文件。

操作失败。
绑定结果:hr = 0x80070002。系统找不到指定的文件。
5)然后我想起之前安装 Moles Framework 时运行的是 Visual Studio 2010。所以我关闭了VS2010并重新安装了它。
6) 这似乎已经成功了

所以长话短说。我的解决方案是关闭 Visual Studio 并重新安装 Moles Framework。

I had the same problem. Started to have problems after converting our solution from VS2008 to VS2010. For some reason when running the unit tests Visual Studio complained about Unable to find HostAdapter "Moles". Then I tried to download the latest version of Moles Framework (0.94.51023.0) and reinstall it.

Then I received the problem that is described above. All tests with the attribute HostType("Moles") failed with the following error.

The test adapter ('Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestAdapter, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Adapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') required to execute this test could not be loaded. Check that the test adapter is installed properly. Object reference not set to an instance of an object.

After a lot of searching I found the reason for my problem.
1) I opened the Visual Studio 2010 Command Prompt and typed fuslogvw which starts the Assembly Binding Log Viewer.
2) I went into Settings and checked Log all binds to disk and Enable custom log path.
3) I started one test that used to fail and the Log Viewer logged a lot of files. I opened the most recent log file and for me this one was: Microsoft.ExtendedReflection, Version=0.94.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.HTM
4) The log file describes how Visual Studio tries to find the Microsoft.ExtendedReflection.dll. But for some reason this file can't be located.

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
5) I then remembered that I had Visual Studio 2010 running when installing Moles Framework the previously. So I closed VS2010 down and re-installed it.
6) This seemed to have done the trick

So to make a long story short. The solution for me was to close down Visual Studio and re-install Moles Framework.

ヅ她的身影、若隐若现 2024-09-25 08:34:08

我也有同样的问题。似乎它是在我在调试模式 调试选择 下开始测试之后开始的,然后中断了执行。之后当我尝试运行测试时,出现了同样的错误。
唯一对我有帮助的是再次使用调试选择运行测试并等待执行结束。然后测试开始正常工作。

I had the same problem. Seems like it began after I started my tests in debug mode Debug Selection and then interrupted execution. When I tried to run my tests after that, I got the same error.
The only thing that helped me, is to run test with Debug Selection again and wait till execution ends. Then tests started to work properly.

那些过往 2024-09-25 08:34:08

似乎会在测试中断时发生(抛出异常等)

要修复,请打开站点的 web.config 并将其更改

  <add name="HostAdapter" type="Microsoft.VisualStudio.TestTools.HostAdapter.Web.HttpModule, Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</httpModules>

</httpModules>

基本上删除“hostadapter”模块...因为如果测试意外失败,则不会之后似乎不会自行清理。

Seems to happen when a test is interuppted (Exception thrown, etc.)

To fix, open the web.config of the site and Change this

  <add name="HostAdapter" type="Microsoft.VisualStudio.TestTools.HostAdapter.Web.HttpModule, Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</httpModules>

to this

</httpModules>

basically deleting the "hostadapter" module ... cause if the test fails unexpectedly it doesn't seem to clean itself up afterwards.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文