Bug Report T508760
Visible to All Users

TestRunner doesn't support running NUnit tests on the .NET Core platform

created 8 years ago

Hi guys,

NUnit support is slowly shaping up, but CodeRush has issues with it - it won't run tests.
See this thread.
Can you check if that's something CodeRush has to fix?
(tested with .NET Core App 1.1) and getting the exception below when running tests from Test Runner:

Test started…
Can not start test framework provider.
Message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Type: System.Reflection.ReflectionTypeLoadException
Source: mscorlib
StackTrace:    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
   at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
   at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ImportEngine.TryGetExports(ExportProvider provider, ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComposition)
   at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportsStateMachine(PartManager partManager, ComposablePart part)
   at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImports(PartManager partManager, ComposablePart part, Boolean shouldTrackImports)
   at System.ComponentModel.Composition.Hosting.ImportEngine.SatisfyImportsOnce(ComposablePart part)
   at System.ComponentModel.Composition.Hosting.CompositionContainer.SatisfyImportsOnce(ComposablePart part)
   at System.ComponentModel.Composition.AttributedModelServices.SatisfyImportsOnce(ICompositionService compositionService, Object attributedPart)
   at DevExpress.CodeRush.TestRunner.Executor45.DefaultTestFrameworkExecutorProvider.GetTestFrameworkExecutor(String runnerAssembly)
Message: Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Type: System.IO.FileNotFoundException
Source:
StackTrace:

Comments (1)
DevExpress Support Team 8 years ago

    Hi Miha,

    Thank you for letting us know about this problem.
    The current CodeRush for Roslyn version doesn't support running NUnit tests on the .NET Core platform. I believe we will fix this soon.

    Answers approved by DevExpress Support

    created 8 years ago

    We have fixed the issue described in this ticket and will include the fix in our next maintenance update. To apply this solution before the official update, request a hotfix by clicking the corresponding link for product versions you require.

    Note: Hotfixes may be unavailable for beta versions and updates that are about to be released.

    Additional information:

    Hi Miha,
    We have researched this issue in detail and here are our results. You see this exception because CRR doesn't correctly handle assembly resolving. We resolved this problem on our side. However, there were issues inside the NUnit Test Adapter and internal exceptions in the 4.0 version which is used in your project. Based on the latest changes in NUnit's Github, the NUnit team have rolled back 4.0 changes, and so we can't research what's is wrong there. RR Test Runner is working correctly with the v3.8 Test Adapter (this pre-release version is available via Nuget). So I suggest you install this build containing our latest fixes:
    http://downloads.devexpress.com/Share/IDE/170519/DevExpress.CodeRush.Roslyn-17.1.3.17139.vsix
    and use NUnit Test Adapter v3.8 - in our internal tests such combination works fine. Please inform us about your experience.

      Comments (2)

        Have tried this hotfix, seemed to work fine as testrunner without the problem described above.
        But when debuging a test, stopping the debug didn't stop the testrun (had to hit the stop button in the test runner windows as well).

        netcoreapp1.1, netstandard1.6 library

        DevExpress Support Team 8 years ago

          Hello,

          To process your recent post more efficiently, I've created a separate ticket on your behalf (T517850: TestRunner doesn't stop the debugging session after the debugger is unattached). It has been placed in our processing queue and will be answered shortly.

          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.