An exception occurred while invoking executor '

2019-01-27 13:08发布

We are using Visual Studio 2012 and Team Foundation Server 2010 in our project. Since, we are using Microsoft Fakes, we could have not used the started Test functionality of our Team Build 2010, I have created a build activity which invokes VSTest.Console.exe passing the test assemblies. This approach has been working well for us. However, after a recent check-in we are getting the following error when executing Vstest.console.exe

Error: An exception occurred while invoking executor 'executor://mstestadapter/v1': Object reference not set to an instance of an object.

I copied the binary files to my local machine and was able to get the error again. Interestingly, we run a dev build before check-in which runs the same vstest.console.exe with the same parameters and that works correctly. I have got two folders on my machine, for one the call works fine and for other it doesn't. The compiled assemblies look same size and there aren't much differences to suggest.

I tried using Process Monitor but couldn't find anything obvious other than that the process returns with an exit code 1. Does anybody know much about this error? Is there any way I can find out more information from my test run?

Regards,

Hamid

7条回答
劫难
2楼-- · 2019-01-27 13:28

I had the same error message just now with Visual Studio 2017 using the new MSTest.Framework and MSTest.TestAdapter (to be able to use Live Unit Testing). It turned out I was using multiple versions of those packages in my solution. Consolidating them to the latest version solved the problem.

查看更多
我只想做你的唯一
3楼-- · 2019-01-27 13:28

An exception occurred while invoking executor 'executor://mstestadapter/v2'

I had multiple TestAdapter's and TestFramework's in my BuildAgents Folder, deleting the v1.1.11 versions fixed the issue:

enter image description here

查看更多
男人必须洒脱
4楼-- · 2019-01-27 13:29

I tried everything on the web to solve this exception. Finally I solved this issue by installing the Update v4 of Visual Studio 2013 (which is that I'm using currently). Hope it helps!

查看更多
该账号已被封号
5楼-- · 2019-01-27 13:30

This is what worked for me: In Visual Studio, Test -> Test Settings -> Default Processor Architecture -> X64.

Though it might not solve everyone's issue, hope it helps some of you out there.

查看更多
女痞
6楼-- · 2019-01-27 13:34

We got to the bottom of the problem. We are using Entity Framework 5.0 and we also have a situation where some of our test assemblies are targeting .Net 4.0 and some are targeting .Net 4.5.

When we are trying to run the tests such that assemblies targeting different versions of .Net framework and using Entity Framework 5.0 are run in the same Test (vstest.console.exe) process, we get this error.

I think this has to do with the way Entity Framework 5.0 ships with two versions (net40 and net45). Once one version of the library is loaded in the process, the other version cannot be loaded and this caused the error.

查看更多
够拽才男人
7楼-- · 2019-01-27 13:48

Deleting app.config and packages.config, if exists, and reinstalling Entity framework via nuGet packages works for me.

查看更多
登录 后发表回答