-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong xUnit runner "xunit.execution.dotnet" chosen for .NET Framework property tests #678
Comments
Maybe it’s the strong naming that causes trouble here. I believe on newer .NET versions it’s handled automatically, but on framework you need an assembly redirect in a config file somewhere. This is compounded by figuring out how to make Xunit see that assembly redirect, as it does its one loading (ie there is no exe). Xunit docs may be some help there. On 2 Apr 2024, at 14:17, Ronnie Holm ***@***.***> wrote:
Repro is available at https://github.com/ronnieholm/FsCheckWrongRunner
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 in the same test class the FsCheck [property] test fails while the regular [Fact] test succeeds.
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:
The test should've executed with xunit.execution.desktop.dll, not xunit.execution.dotnet as the test project is a .NET Framework 4.8 project, not a .NET Core project.
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?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Indeed. I have other .NET Framework 4.8 test projects with xUnit and FsCheck where I need the following binding redirects in the test project's <dependentAssembly>
<assemblyIdentity name="xunit.core" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="2.2.0.0-2.4.2.0" newVersion="2.4.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="xunit.execution.desktop" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
<bindingRedirect oldVersion="2.2.0.0-2.4.2.0" newVersion="2.4.2.0" />
</dependentAssembly> The above is from a test project running xUnit 2.4.2 and FsCheck 2.16.5. No problem with the For the Repro example, I've been using PerfView to trace assembly load events during test discovery and execution in VS. The following assemblies are getting loaded: Notice the highlighted one: What makes xUnit attempt to load |
I was experimenting with keeping the xUnit version fixed at 2.7.0 and varying the FsCheck version, going back to 2.16.6. FsCheck starts failing between release 3.0.0-alpha4 and 3.0.0-alpha5, i.e., alpha5 is the first release with the failure. |
From the results below, I'm not convinced the missing I enabled Fusion logging and re-ran the test from the PowerShell terminal:
It yielded the following output:
Observe how the loader is attempting to locate I then build
Inspecting the log with the MSBuild Structured Log Viewer, it contains unexpected entries like this one: Notice at the bottom it says To verify, I loaded Sure enough, I think this shouldn't be the case. |
Ok, from the xunit site https://xunit.net/docs/nuget-packages
So that seems to be the right thing for us to reference. Perhaps these are not forward compatible with xunit 2.7 though. If you downgrade xunit to 2.4 does it work? |
I have same problem. How about change
|
See xunit/xunit#2576 |
released in 3.0.1 |
If you create a new .NET 4.8 test project and reference
then the FsCheck
[<Property>]
test fails while the regular[<Fact>]
test succeeds.The failure is:
Two things stand out about the failure:
xunit.execution.desktop.dll
, notxunit.execution.dotnet.dll
as the test project is a .NET Framework 4.8 project, not a .NET Core project.2.4.1.0
version is wrong and should've been2.7.0.0
as that's the version of thexunit.extensibility.execution
NuGet package referenced.Any tips on how to narrow down the cause?
The text was updated successfully, but these errors were encountered: