xunit / visualstudio.xunit

VSTest runner for xUnit.net (for Visual Studio Test Explorer and dotnet test)
https://xunit.net/
Other
144 stars 81 forks source link

xunit.runner.visualstudio/2.5.3 references 2.5.2 version of xunit #390

Closed ViktorHofer closed 10 months ago

ViktorHofer commented 10 months ago

xunit.runner.visualstudio.testadapter from xunit.runner.visualstudio/2.5.3 references xunit/2.5.2 assemblies:

image

You can see that the assembly metadata points to xunit.runner.utility.net452, Version=2.5.2.0.

When using xunit/2.5.3 in combination with xunit.runner.visualstudio/2.5.3, the assembly version of xunit.runner.utility.net452 in the output directory is 2.5.3.0. This leads to the following failure when invoking dotnet test -f net462 --diag:log.txt on a .NET Framework test app:

TpTrace Warning: 0 : 14244, 3, 2023/10/30, 19:39:47.511, 3877462031738, testhost.exe, LoaderExceptions: System.IO.FileNotFoundException: Could not load file or assembly 'xunit.runner.utility.net452, Version=2.5.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' or one of its dependencies. The system cannot find the file specified. File name: 'xunit.runner.utility.net452, Version=2.5.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at Microsoft.VisualStudio.TestPlatform.Common.ExtensionFramework.TestPluginCache.CurrentDomainAssemblyResolve(Object sender, AssemblyResolveEventArgs args) in //src/Microsoft.TestPlatform.Common/ExtensionFramework/TestPluginCache.cs:line 513 at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

The version is hardcoded to 2.5.2 here: https://github.com/xunit/visualstudio.xunit/blob/097b60584fb932d3dcff297de827c543c879c7f4/Versions.props#L13

cc @bradwilson

bradwilson commented 10 months ago

That's because 2.5.3 of the VS adapter was released with 2.5.2 of the core framework.

Why does it matter?

bradwilson commented 10 months ago

Are you coding against runner utility?

bradwilson commented 10 months ago

image

ViktorHofer commented 10 months ago

Yikes, I should have come up with a repro first... Let me get back to you.

bradwilson commented 10 months ago

Going to close this as it's not us. I've added comments to https://github.com/dotnet/runtime/issues/94183 and happy to help with any followup necessary there.