Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Xunit.v3 analysis failure
damianh
#1 Posted : Saturday, September 28, 2024 10:51:08 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/5/2014(UTC)
Posts: 23
Location: Netherlands

Thanks: 2 times
Was thanked: 4 time(s) in 4 post(s)
When attempting to use xunit.v3 (Version="0.4.0-pre.20") get analysis failure:

An error occurred while analysing this project after it was built: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.MissingMethodException: Method not found: 'System.Collections.Generic.HashSet`1<System.String> Xunit.Runner.Common.XunitFilters.get_IncludedClasses()'.
at Xunit.Runner.v3.Xunit3ArgumentFactory.ToArguments(Version coreFrameworkVersion, String configFileName, String culture, Nullable`1 diagnosicMessages, Nullable`1 disableParallelization, Nullable`1 explicitOption, Nullable`1 failSkips, Nullable`1 failTestsWithWarnings, XunitFilters filters, Nullable`1 internalDiagnosticMessages, Nullable`1 listOption, Nullable`1 maxParallelThreads, Nullable`1 methodDisplay, Nullable`1 methodDisplayOptions, Nullable`1 parallelAlgorithm, Nullable`1 preEnumerateTheories, Nullable`1 seed, IReadOnlyCollection`1 serializedTestCases, Nullable`1 stopOnTestFail, Nullable`1 synchronousMessages, Boolean waitForDebugger)
at Xunit.Runner.v3.Xunit3ArgumentFactory.ForFind(Version coreFrameworkVersion, ITestFrameworkDiscoveryOptions options, XunitFilters filters, String configFileName, Nullable`1 listOption, Boolean waitForDebugger) in C:\Projects\3rdparty\xunit\src\xunit.v3.runner.utility\Frameworks\v3\Xunit3ArgumentFactory.cs:line 31
at Xunit.Runner.v3.Xunit3.Find(IMessageSink messageSink, FrontControllerFindSettings settings) in C:\Projects\3rdparty\xunit\src\xunit.v3.runner.utility\Frameworks\v3\Xunit3.cs:line 102
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of inner exception stack trace ---
at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
at System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at nCrunch.Module.XUnit3.ReflectionWrapper.Xunit3.Find(Object messageSink, FrontControllerFindSettings settings)
at nCrunch.Module.XUnit3.XUnit3DiscoveryEnvironment.FindFrameworkTestsInAssembly(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
at nCrunch.TestExecution.TestFinder..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.TestExecution.TestFinder..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.TestExecution.TestFinder.FindTestsForFrameworks(ReflectedAssembly assembly, FilePath assemblyFilePath, IList`1 referencedAssemblyFilePaths, DescribedTestFrameworkDiscoverer[] describedDiscoverers, ComponentUniqueName testComponentUniqueName, PlatformType platformType, DynamicProxy[] dynamicProxies)
at nCrunch.TestExecution.RemoteTaskRunner.AnalyseAssembly(DescribedTestFrameworkDiscoverer[] applicableFrameworks, ComponentUniqueName testComponentUniqueName, PerfTracker perfTracker, TaskLogId taskLogId)


The tests are discovered and run in VS test runner and resharper test runner.
Remco
#2 Posted : Saturday, September 28, 2024 1:14:05 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,135

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Thanks for sharing this issue.

This is caused by an inconsistency between the xunit runner libraries that are packaged with NCrunch, and the xunit runtime libraries referenced from your test project.

Basically, the main xunit Nuget package doesn't ship with the runner libraries, so it's the responsibility of runners (like NCrunch) to provide them. The current set of binaries packaged with NCrunch is consistent with xunit 0.3.0-pre.18, which seems to have a clash with 0.4.0-pre.20. The reason for this is because we finalised our integration with xunit about 2-3 weeks ago, at which point 0.3.0-pre.18 was the latest version. The smart move would have been for us to update our binaries just prior to our own release ... but of course, we forgot to do that. So when NCrunch v5.10 went out yesterday it was already out of alignment with the latest pre-release of xunit.

Because it's expected that xunit is likely to still see changes like this while in a PR state, we did try to implement forwards compatibility with future versions of the libraries, but depending on the versions involved, you may still need to have the runner library versions match those of the runtime ones. NCrunch has a built-in override through which it will always use the runner libraries being referenced by your project before using the ones packaged with itself. To use this override, you'll need to have your own copies of these runner libraries:

xunit.v3.common.dll
xunit.v3.runner.common.dll
xunit.v3.runner.utility.netcore.dll or xunit.v3.runner.utility.netfx.dll (depending on your platform)
xunit.v3.runner.inproc.console.dll

They need to be referenced directly from the project to work. I don't think there is a Nuget reference available for these yet, so it would probably need to be done using a <Reference Include="AssemblyName.dll" /> inside the project file (i.e. old school assembly reference). I've just checked quickly and it looks like it might take a few steps to get hold of these files. You might need to build them from source.

Alternatively, you can use a slightly older version of xunit, v0.3.0-pre.18, which should work just fine.

We'll update our own copies of the binaries the next time we push a build.
damianh
#3 Posted : Saturday, September 28, 2024 1:18:09 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/5/2014(UTC)
Posts: 23
Location: Netherlands

Thanks: 2 times
Was thanked: 4 time(s) in 4 post(s)
Thanks.for the detailed response.

I'll downgrade to 0.3.0-pre.18 for now and will upgrade on next ncrunch build.

Cheers!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.049 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download