Skip to content

Wrong xUnit runner "xunit.execution.dotnet" chosen for .NET Framework property tests #678

@ronnieholm

Description

@ronnieholm

If you create a new .NET 4.8 test project and reference

  • FsCheck.3.0.0-rc3
  • FsCheck.Xunit.3.0.0-rc3
  • xunit.2.7.0
  • Other xUnit dependencies in 2.7.0 version

then the FsCheck [<Property>] test fails while the regular [<Fact>] test succeeds.

module FsCheckBug

open Xunit
open FsCheck.Xunit

[<Fact>]
let succeeds() =
    Assert.True(true)

[<Property>]
let fails() =
    Assert.True(true)

The failure is:

System.InvalidOperationException : Exception during discovery:
System.IO.FileNotFoundException: Could not load file or assembly 'xunit.execution.dotnet, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The system cannot find the file specified.
File name: 'xunit.execution.dotnet, Version=2.4.1.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c'
   at FsCheck.Xunit.PropertyDiscoverer.Xunit.Sdk.IXunitTestCaseDiscoverer.Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo _arg1)
   at Xunit.Sdk.XunitTestFrameworkDiscoverer.FindTestsForMethod(ITestMethod testMethod, Boolean includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkDiscoverer.cs:line 119
   at Xunit.Sdk.XunitTestFrameworkDiscoverer.FindTestsForType(ITestClass testClass, Boolean includeSourceInformation, IMessageBus messageBus, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkDiscoverer.cs:line 135

Two things stand out about the failure:

  1. The test should've executed with xunit.execution.desktop.dll, not xunit.execution.dotnet.dll as the test project is a .NET Framework 4.8 project, not a .NET Core project.
  2. The 2.4.1.0 version is wrong and should've been 2.7.0.0 as that's the version of the xunit.extensibility.execution NuGet package referenced.

Any tips on how to narrow down the cause?

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