Build/Test Issues

NCrunch using wrong bindingRedirect

Started by lstahel on 4,805 views

I am having following Problem:

We have a few Tests that use xBehave. All of the tests get built and executed without problems with the VS 17 Test environment. But with NCrunch we get following Error:

System.TypeLoadException: Der Typ "Xunit.LongLivedMarshalByRefObject" in der Assembly "xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c" konnte nicht geladen werden.
bei Xbehave.Execution.ScenarioRunnerFactory.Create(Object[] scenarioMethodArguments)
bei Xbehave.Execution.ScenarioOutlineRunner.<AfterTestCaseStartingAsync>d__8.MoveNext()


But the app.config clearly has different configuration:

<dependentAssembly>
        <assemblyIdentity name="xunit.core" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.0.3545" newVersion="2.2.0.3545" />
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="xunit.execution.desktop" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.0.3545" newVersion="2.2.0.3545" />
      </dependentAssembly>


I tried with different configurations with the Build in Ncrunch but nothing seems to help.

(NCrunch 3.6.0.2, xUnit 2.2.0.3545, xBehave 2.2.0-beta0003-build685)
Hi, thanks for sharing this problem.

At the moment, NCrunch is still on xunit v2.1. There are plans to upgrade this to v2.2 along with some integration changes to allow the engine to be more forwards-compatible with future versions of xunit.

To immediately solve this problem, you have two options:
1. You can try updating the xunit DLLs in the NCrunch installation directory. In theory, this should allow NCrunch to immediately start using xunit v2.2. In practice, this hasn't yet been tested.
2. You can downgrade your version of xbehave to an earlier version which is integrated with xunit v2.1. Assuming you also downgrade your version of xunit, it should then work correctly.

Post a reply

Log in to reply.