Bug Report T951770
Visible to All Users

Test Runner crashes if .NET 5 tests run on multi-targeting project layouts

created 4 years ago

Hello,

I have an SDK-styled test project (it uses xUnit) which defines the following targets:

XML
<PropertyGroup> <TargetFrameworks>netcoreapp3.1;net452</TargetFrameworks> </PropertyGroup>

CodeRush's Test Runner used to work just fine with it, until I added .NET 5 as a target:

XML
<PropertyGroup> <TargetFrameworks>net5.0;netcoreapp3.1;net452</TargetFrameworks> </PropertyGroup>

Now whenever I try to run .NET 5 tests using CodeRush's Test Runner, I get the following output:

Code
System.IO.FileNotFoundException: Impossible de charger le fichier ou l'assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ou une de ses dépendances. Le fichier spécifié est introuvable. Nom de fichier : 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' à System.ModuleHandle.ResolveMethod(RuntimeModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount) à System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount) à System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) à System.Reflection.CustomAttributeData..ctor(RuntimeModule scope, CustomAttributeRecord caRecord) à System.Reflection.CustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget) à System.Reflection.CustomAttributeData.GetCustomAttributesInternal(RuntimeAssembly target) à Xunit.Sdk.ReflectionAssemblyInfo.GetCustomAttributes(String assemblyQualifiedAttributeTypeName) à Xunit.Sdk.XunitTestFrameworkDiscoverer..ctor(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory) à Xunit.Sdk.XunitTestFramework.CreateDiscoverer(IAssemblyInfo assemblyInfo) à Xunit.Sdk.TestFramework.GetDiscoverer(IAssemblyInfo assemblyInfo) à Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) à Xunit.XunitFrontController.CreateInnerController() à Xunit.XunitFrontController.get_InnerController() à Xunit.XunitFrontController.Find(Boolean includeSourceInformation, IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions) à DevExpress.CodeRush.TestRunner.xUnit21.Executor.LoadTests()

Oddly enough, if I remove multi-targeting and use .NET 5 as the sole target, the runner works as expected.

XML
<PropertyGroup> <TargetFramework>net5.0</TargetFramework> </PropertyGroup>

Of course I cannot use that as a workaround, I do need to validate that my tests runs the same on each of the framework above.

Can you tell what's wrong here? Is it a bug?

Thanks.

Comments (3)
DevExpress Support Team 4 years ago

    Hello David,
    Thank you for xml-snippets and the call stack. I have reproduced the problem. Once we fix it, we will notify you in the current ticket.

      I can also confirm this error, I just noticed that this error is caused by DevExpress.CodeRush.TestRunner.xUnit21.Executor.LoadTests().

      If it helps, I'm using xunit 2.4.1 with xunit.runner.visualstudio 2.4.3

      DevExpress Support Team 4 years ago

        Hi Daniel,
        Thank you for the information. We will take your configuration into account when working on this issue.

        Answers approved by DevExpress Support

        created 4 years ago

        We have addressed the issue described in this ticket and will include a fix in our next maintenance update. Should you need to apply our fix prior to official release, you can request a hotfix here.

        Note: Hotfixes may be unavailable for betas/updates set for release within a week.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.