locked
VS 2010: Error when trying to generate Unit Test RRS feed

  • Question

  • Hi!


    I have problem while trying to generate Unit test in VS 2010. I get following message:

    While trying to generate your tests, the following errors occurred: Object reference not set to an instance of an object.

     

    Any clue what that might be ?

     

    Sunday, May 16, 2010 5:49 PM

Answers

  • Hi, I've just stumbled upon this exact problem. Whenever I attempt to add unit tests to an existing test project I get the error described above printed to the output window and a new file with no tests added to the test project.

    I've tried several classes from several different projects in my solution, but all produce the same result. I tried to reproduce the behaviour on another small solution, but that works fine.

     

    However I have found that adding tests to a new test project seems to work ok in my main solution, which is how I'll be working around this issue.

    Tuesday, November 2, 2010 5:40 PM

All replies

  • Does this reproduce every time?  If so, can you provide sample code that will reproduce this problem?


    Thanks, Lonny
    Wednesday, June 2, 2010 1:49 AM
  • Maybe some project can not be understand or recognized. Pls unload them.
    Saturday, June 26, 2010 2:59 AM
  • Somewhere it is trying to use a reference variable before it has been instantiated. Comment out code then add it back in one section at a time until you find where the error is. Once you have it narrowed down you should be able to spot where something is not being instantiated.

     


    Just because the code works, doesn't mean it is good code.
    Tuesday, June 29, 2010 8:28 PM
  • Hi, I've just stumbled upon this exact problem. Whenever I attempt to add unit tests to an existing test project I get the error described above printed to the output window and a new file with no tests added to the test project.

    I've tried several classes from several different projects in my solution, but all produce the same result. I tried to reproduce the behaviour on another small solution, but that works fine.

     

    However I have found that adding tests to a new test project seems to work ok in my main solution, which is how I'll be working around this issue.

    Tuesday, November 2, 2010 5:40 PM
  • Hi,

    instead of working around the problem I was able to solve the problem by removing the following XML block in the existing test project file (TestProject.csproj):

        <FileUpgradeFlags>
        </FileUpgradeFlags>
        <OldToolsVersion>4.0</OldToolsVersion>
        <UpgradeBackupLocation />
        <IsWebBootstrapper>false</IsWebBootstrapper>
        <PublishUrl>publish\</PublishUrl>
        <Install>true</Install>
        <InstallFrom>Disk</InstallFrom>
        <UpdateEnabled>false</UpdateEnabled>
        <UpdateMode>Foreground</UpdateMode>
        <UpdateInterval>7</UpdateInterval>
        <UpdateIntervalUnits>Days</UpdateIntervalUnits>
        <UpdatePeriodically>false</UpdatePeriodically>
        <UpdateRequired>false</UpdateRequired>
        <MapFileExtensions>true</MapFileExtensions>
        <ApplicationRevision>0</ApplicationRevision>
        <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
        <UseApplicationTrust>false</UseApplicationTrust>
        <BootstrapperEnabled>true</BootstrapperEnabled>

    In my case the problem occured afer I installed PEX (http://research.microsoft.com/en-us/projects/pex/).
    And the problem remained after uninstalling. 

    Greetings

    Harry


    Best regards,
     
    Harald Binkle


    Exchange Server Toolbox | SmartPOP2Exchange | SmartBackup | SpamAssassin
    JAM Software GmbH
    Max-Planck-Str.22 * 54296 Trier * Germany
    http://www.jam-software.com


    Thursday, April 5, 2012 1:54 PM