Giter Club home page Giter Club logo

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) about vstest HOT 4 CLOSED

fowl2 avatar fowl2 commented on June 9, 2024
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)

from vstest.

Comments (4)

nohwnd avatar nohwnd commented on June 9, 2024

Could you show the dependencies you have in the tested project please?

Are there any other dependencies in your test project or just the test framework?

from vstest.

nohwnd avatar nohwnd commented on June 9, 2024

We've updated the .Unsafe library, which was "accidentally" making your project work. At least that is how I understand the problem. Please try adding Microsoft.NET.Test.SDK package reference to your project, or try adding <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> into your project properties. This should generate the correct redirects, so the library that is trying to load the 4.x.x uses 6.x.x instead of loading the 4.x.x from test platform, and then later silently skipping loading 6.x.x.

from vstest.

nohwnd avatar nohwnd commented on June 9, 2024

https://developercommunity.visualstudio.com/t/Tests-fail-on-VS-1770-but-not-in-176/10441058

from vstest.

fowl2 avatar fowl2 commented on June 9, 2024

Thanks!

Adding <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType> into the test project worked.

A bit surprising as I'd always considered test projects to be libraries only - and binding redirects I thought only operated on exes/hosts. I guess there's some magic- AppDomain/AssemblyLoadContext? - but then wouldn't it be seperated from the test platform too?

Adding a package reference to Microsoft.NET.Test.SDK to the test project didn't help btw.

so the library that is trying to load the 4.x.x uses 6.x.x instead of loading the 4.x.x from test platform,

Ahh that makes sense. The tested project brings in v6, and has the moral equivalent of GenerateBindingRedirectsOutputType jury rigged binding redirect mechanism using AppDomain.CurrentDomain.AssemblyResolve because it's an Azure Functions v1 project that doesn't support that normally.

then later silently skipping loading 6.x.x.

How is that possible?

Are there any other dependencies in your test project or just the test framework?

That's the complete project file for the test project.

Another day, another fight with dependencies and assembly binding - I'm unblocked. Thanks again.

from vstest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.