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

  • Question

  • Hi,

    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


    • Moved by Amanda Zhu Monday, January 28, 2013 5:48 AM
    Thursday, January 24, 2013 2:26 PM

Answers

  • Hello all,

    Thanks for your answers. I am using TFSBuildExtensions to run the unit tests. Have created a new activity VSTEST which starts up a new process of VsTest.console.exe and executes it with all the test containers passed as command line parameters. 

    We got to the bottom of this issue. Basically we are using Entity Framework 5.0 and we also have a situation where some of our libraries need to target .net 4.0 and some needs to target .net 4.5. Since EntityFramework 5.0 uses different versions for assemblies targetting different versions, we could run our test containers targetting .Net 4.0 in the same process as test containers targetting .Net 4.5. Run them in a separate vstest.console.exe process works absolutely fine.

    Thanks for all your help,

    Cheers,

    Hamid

    • Marked as answer by Hamid Shahid Wednesday, January 30, 2013 4:05 PM
    Wednesday, January 30, 2013 4:05 PM

All replies

  • Hi Hamid,

    I am going to try out your scenario.  Can you give me more information about how your tests are using fakes?  If you can share your solution or create a sample solution that repros the issue that would be helpful.

    Also are you using VS2012 with Update1, or with a CTP installed?

    Thanks,

    Lou

    Thursday, January 24, 2013 7:45 PM
  • Hello,

    We have a forum Team Foundation Server - Build Automation for this issue. In order to provide better support, I will move this thread.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 28, 2013 5:47 AM
  • Hi Hamid,

    Thanks for your post!

    Given that you are using TFS 2010 you are effectively using mstest within your build process to execute your tests. Installing VS2012 does not suffice. These will fail since mstest does not comprehend the new framework.

    The new testing framework requires the new test executor vstest.console.exe. Once you pgrade to TFS2012 you will see an option in your process definition to run your tests using vstest.console.exe and only then will the new native test be discovered and executed.

    For you to run your tests using TFS2010 you would have to effectively create a custom build definition that uses your version of RunTests which invokes the new executor and there too you won’t get all our integration eg. code coverage etc seamlessly.

    For more information, please refer tohttp://social.msdn.microsoft.com/Forums/en/tfsbuild/thread/4d603031-0fdd-4194-9435-98a27b8e9e4f

    Hope it helps!

    Best Regards,


    Cathy Kong
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, January 28, 2013 9:22 AM
    Moderator
  • Hello all,

    Thanks for your answers. I am using TFSBuildExtensions to run the unit tests. Have created a new activity VSTEST which starts up a new process of VsTest.console.exe and executes it with all the test containers passed as command line parameters. 

    We got to the bottom of this issue. Basically we are using Entity Framework 5.0 and we also have a situation where some of our libraries need to target .net 4.0 and some needs to target .net 4.5. Since EntityFramework 5.0 uses different versions for assemblies targetting different versions, we could run our test containers targetting .Net 4.0 in the same process as test containers targetting .Net 4.5. Run them in a separate vstest.console.exe process works absolutely fine.

    Thanks for all your help,

    Cheers,

    Hamid

    • Marked as answer by Hamid Shahid Wednesday, January 30, 2013 4:05 PM
    Wednesday, January 30, 2013 4:05 PM
  • Hi,
    I have the same error specified in the subject when in the AssemblyInfo of the project is specified the AssemblyAttribute:

    [assembly: AssemblyCulture("en")]

    If this attribute is present, the run of the unit tests fails.
    If I remove this line of code or I remove the "en" language, the run of the unit tests success.

    Thursday, April 18, 2013 8:27 AM
  • Hello,

    we have Visual studio Proffesional license and after downloading files which were in VS2012 ultimate where throwing error in proffesional 2012 with win 7 operating system while running test .

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

    please suggest .

    Monday, March 24, 2014 11:46 AM
  • Hi,

    We are also getting this exception (using VS 2013 Update 1). I see two problems:

    1) We don't get the full error information (it's a managed exception, so it is possible to get a nice stack trace to assist in locating the error),

    2) MS haven't located / described the root cause, giving us the opportunity to work around this bug, and hence "everyone" is just guessing on which sets of inputs causes the issue :-(

    Reproducing errors is a poor mans tool - here log data / proof can be delivered..

    Come on almighty product support :-)

    Thursday, March 27, 2014 2:41 PM
  • Hi,

    We tried with VS 2013 Update 4 but still no luck

    With regards,

    Ramesh T R

    Tuesday, September 8, 2015 2:53 PM
  • Hello all,

    Thanks for your answers. I am using TFSBuildExtensions to run the unit tests. Have created a new activity VSTEST which starts up a new process of VsTest.console.exe and executes it with all the test containers passed as command line parameters. 

    We got to the bottom of this issue. Basically we are using Entity Framework 5.0 and we also have a situation where some of our libraries need to target .net 4.0 and some needs to target .net 4.5. Since EntityFramework 5.0 uses different versions for assemblies targetting different versions, we could run our test containers targetting .Net 4.0 in the same process as test containers targetting .Net 4.5. Run them in a separate vstest.console.exe process works absolutely fine.

    Thanks for all your help,

    Cheers,

    Hamid

    For me this is not an answer rather a root cause analysis report. Answer is the solution for the problem or at-least a work-around as a temporary fix.
    Tuesday, September 8, 2015 2:54 PM