none
BuildShadowTask" task failed unexpectedly (VS2012 update2) RRS feed

  • Question

  • I have a .NET 4.5 C# unit test project that fails to build for some reason.  This is the error.

    Error 21 The "BuildShadowTask" task failed unexpectedly.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.VisualStudio.TestTools.BuildShadowReferences.BuildShadowTask.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() CT.iMagio2.Dal.Documents.Tests

    This error is greek to me.  What does it mean?  How do I resolve it?

    Thursday, May 2, 2013 2:45 PM

Answers

  • I have a .NET 4.5 C# unit test project that fails to build for some reason.  This is the error.

    Error 21 The "BuildShadowTask" task failed unexpectedly.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.VisualStudio.TestTools.BuildShadowReferences.BuildShadowTask.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() CT.iMagio2.Dal.Documents.Tests

    This error is greek to me.  What does it mean?  How do I resolve it?

    The build error reported by Visual Studio 2012 update 2 was not helpful at all.

    I had to unload the project and hand edit the project file and remove the Shadow include line.  Yuck!

      <ItemGroup>

        <None Include="app.config">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
          <SubType>Designer</SubType>
        </None>
        <None Include="packages.config" />
        <None Include="Resources\wallpaper 08.JPG" />
        <Shadow Include="Test References\CT.Acme.Impl.accessor" />
      </ItemGroup>

    • Marked as answer by scott_m Thursday, May 2, 2013 7:05 PM
    Thursday, May 2, 2013 7:05 PM

All replies

  • I have a .NET 4.5 C# unit test project that fails to build for some reason.  This is the error.

    Error 21 The "BuildShadowTask" task failed unexpectedly.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.VisualStudio.TestTools.BuildShadowReferences.BuildShadowTask.Execute()
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() CT.iMagio2.Dal.Documents.Tests

    This error is greek to me.  What does it mean?  How do I resolve it?

    The build error reported by Visual Studio 2012 update 2 was not helpful at all.

    I had to unload the project and hand edit the project file and remove the Shadow include line.  Yuck!

      <ItemGroup>

        <None Include="app.config">
          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
          <SubType>Designer</SubType>
        </None>
        <None Include="packages.config" />
        <None Include="Resources\wallpaper 08.JPG" />
        <Shadow Include="Test References\CT.Acme.Impl.accessor" />
      </ItemGroup>

    • Marked as answer by scott_m Thursday, May 2, 2013 7:05 PM
    Thursday, May 2, 2013 7:05 PM
  • Hi,

    I’m glad to hear that you got it working.

    Thank you for sharing your solutions & experience here. It will be very beneficial for other community members who have similar questions.

    Best regards,


    Ego [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.

    Friday, May 3, 2013 7:54 AM
    Moderator
  • Thanks, that did it.  I had to remove the whole Item Group

    Mine looked like:

    <ItemGroup>

            <Shadow Include="Blah" />

      </ItemGroup>


    The Bunny did math well.

    Thursday, November 14, 2013 3:10 PM
  • I ran into this when trying to unit test in an ASP.NET site.

    I had to rename my web.config file (I called it web.config.bak), then rename web.config.backup to web.config, then rebuild the site and things worked again.Once it built the site, I flipped them back.

    Friday, January 16, 2015 8:25 PM