Skip to content

Test fails after update 17.6.5->17.7.1 - System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) #4673

@fowl2

Description

@fowl2

A test that passed before is now failing after an update of the tools.

The error is:

   Test method redacted.Tests.redacted.redacted threw exception: 
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Stack Trace:
   at System.ReadOnlyMemory`1.get_Span()
   at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
   at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
   at redacted() in D:\a\1\s\src\redacted.cs:line 7
   at redacted() in D:\a\1\s\src\redacted.Tests\redacted.cs:line 10

This change looks scary where it changes how System.* dlls are copied. Emphasis on the The located assembly's manifest definition does not match the assembly reference and he differing version between the error message and what is in the output folder.

packages.lock.json snippet:

      "System.Runtime.CompilerServices.Unsafe": {
        "type": "Transitive",
        "resolved": "6.0.0",
        "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
      },

Environment

TargetFramework: net48

Failing in Azure DevOps since the image was updated today. Verified it also fails on my local Windows dev machine after updating VS.

Versions from the pipeline:

Component Old / Working New / Failing diff
VSTest@2
Azure DevOps task
2.224.0 2.227.0 microsoft/azure-pipelines-tasks@e037603
DtaExecutionHost 19.210.32906.4 19.226.34002.2
vstest.console.exe
Microsoft (R) Test Execution Command Line Tool (x64)
17.6.2 17.7.0
Azure DevOps Pipeline Image 20230804.1.0 20230820.1.0 actions/runner-images@568917b
Visual Studio Enterprise 2022 17.6.33829.357 17.7.34009.444

Project File

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\redacted\redacted.csproj" />
    <ProjectReference Include="..\redacted\redacted.csproj">
      <Project>{09226a53-4426-423c-a014-33b4473e4aa8}</Project>
      <Name>redacted</Name>
    </ProjectReference>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="MSTest.TestAdapter">
      <Version>3.1.1</Version>
    </PackageReference>
    <PackageReference Include="MSTest.TestFramework">
      <Version>3.1.1</Version>
    </PackageReference>
  </ItemGroup>

</Project>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions