Problems with .NET unit testing

 

JetBrains Rider automatically detects unit tests and provides a unit test runner to run and debug them. We are continuously improving unit testing with JetBrains Rider, but there are still some areas which are not supported.

So what is currently supported and what is not? 

  Supported since 2017.2
Unit testing Frameworks

xUnit

NUnit

Classic MSTest (Windows-only)

MSTest v2 (.NET Core projects - cross-platform, .NET Framework projects - Windows-only)

Runtime

.NET Framework

.NET Core

Mono (4.8+ recommended)

If you experience any issues with a supported unit testing framework on a supported runtime, please create a request and describe the problem in details, as it will help to sort it out timely. The following information is essential to determine the cause of the issue:

Environment

  1. OS version, for example, Windows 10 or Mac OS X 10.8
  2. JetBrains Rider version: Help -> About
  3. Unit testing framework version, for example, xUnit 2.2.0
  4. MSBuild version: Settings -> Build, Execution, Deployment -> Toolset and Build (find screenshot below)
  5. .NET Core version in case you have .NET Core project:
    • Check a path to dotnet executable via Settings -> Build, Execution, Deployment -> Toolset and Build (find screenshot below)
    • Go to the directory with dotnet executable via terminal
    • Run "dotnet --version" command

Log Files

  1. Build your solution and then collect Rider logs: Help -> Collect Logs
  2. Run Unit Tests if you can see them in unit test explorer 
    • Get launch log files: Launch settings -> Show Last Launch Log (find screenshot below) or click on gear icon -> Diagnostics -> Show Last Launch Log
    • Get unit test process log files as described here
  3. Attach the logs to the request

Screenshot_2020-06-03_at_17.57.49.png

 

Additional information

  1. Sample solution where the issue reproduces is very much appreciated
  2. Can you see your unit tests in unit test explorer?
  3. Are there any steps to reproduce the issue?
  4. Has it worked in the previous version of JetBrains Rider?

 Thank you for helping us make JetBrains Rider better!

40 comments
Comment actions Permalink

Same problem as the above two individuals. Trying to run XUnit against .NET Core 3.1 / .NET Standard 2.1 projects. Tests have only recently started failing (possibly since the latest Rider update).

Running Rider 2020.2 on Mac OS 10.15.6.

 

 

0
Comment actions Permalink

Devis Nikola Stephen Kennedy,

 

This seems like a known issue. Please, try running tests against x64 platform explicitly via "Session Options" - I'm attaching a couple of screenshots as a reference.

3
Comment actions Permalink

Thanks Kirill Filin that helped.

0
Comment actions Permalink

Just a "me too" from me, I'm afraid, same thing started yesterday. I've found "Invalidate Caches / Restart..." makes it work again for a few runs.

0
Comment actions Permalink

For the BadImageFormatException, changing this setting to x64 seems to have fixed the problem.  

0
Comment actions Permalink

Getting an exit code 139 whenever a unit test runs a struct's public override string ToString() method.

I'm on MacOS 11.0.1 even though the version below shows 10.16 =\

JetBrains Rider 2020.3
Build #RD-203.5981.141, built on December 11, 2020
Licensed to Second Dinner / Mike Schweitzer
Subscription is active until January 8, 2021
Runtime version: 11.0.9.1+11-b1145.24 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
.NET Core 3.1.8
macOS 10.16
GC: ParNew, ConcurrentMarkSweep
Memory: 1450M
Cores: 16
Registry: debugger.new.debug.tool.window.view=true, ide.tree.horizontal.default.autoscrolling=false, performance.watcher.sampling.interval.ms=200, ide.borderless.tab.caption.in.title=false, ide.tooltip.showAllSeverities=true, show.diff.preview.as.editor.tab=true, debugger.show.values.use.inlays=false, undo.documentUndoLimit=10000, light.edit.file.open.enabled=false, performance.watcher.unresponsive.interval.ms=1000, ide.tree.expand.navigatable.on.double.click.disabled=true, search.everywhere.settings=true, show.diff.preview.as.editor.tab.with.single.click=true, parameter.info.max.visible.rows=10, ide.win.file.chooser.native=true, undo.globalUndoLimit=1000, vcs.log.show.diff.preview.as.editor.tab=true, actionSystem.fix.alt.gr=false, search.everywhere.pattern.checking=false, ide.tooltip.initialDelay=0, ide.require.transaction.for.model.changes=false, ide.debug.in.title=true, ide.new.project.model=false, rdclient.asyncActions=false
Non-Bundled Plugins: com.jetbrains.rider.fsharp, PythonCore, aws.toolkit

0
Comment actions Permalink

same like Nikola and Davis.

I have installed Rider 2020.3 and developing a dotnet 3.1 console application.

And change platform Architecture to "x64" doesn't help at all.
I do run "Cover Selected Unit Test" and get :

08:44:45.976 |I| Process C:\Users\f01bergm\AppData\Local\JetBrains\Toolbox\apps\Rider\ch-0\203.5981.141\lib\ReSharperHost\TestRunner\netcoreapp2.0\ReSharperTestRunner64.exe:3000 has exited
08:44:46.022 |V| Process was not started by this object, so requested information cannot be determined.

--- EXCEPTION #1/2 [InvalidOperationException]
Message = “Process was not started by this object, so requested information cannot be determined.”
ExceptionPath = Root.InnerException
ClassName = System.InvalidOperationException
....
Edited by Frank01 Bergmann
0
Comment actions Permalink

Frank01 Bergmann, it seems to be the same issue as this one: https://youtrack.jetbrains.com/issue/RIDER-29932.
Please reproduce it in a newer Rider version 2021.1, collect logs and attach to this issue. Also, having a sample solution/example would be very much appreciated.

K.R.

Sofia

0
Comment actions Permalink

Hi, I'm running Rider 2021.2.1 and am unable to see any variable values while running NUnit tests. All I get on the variables is" The name 'variable' does not exist in the current context" as shown below.  

0
Comment actions Permalink

Hi Iestyn Jones,

Could you please enable `Debugger` tracing in `Help | Diagnostic Tools | Choose Trace Scenario`, then reproduce the issue once again, collect logs via `Help | Collect Logs`, disable tracing, and share the full log bundle via submitting a new support request (https://rider-support.jetbrains.com/hc/en-us/requests/new)?

0

Please sign in to leave a comment.

Have more questions?

Submit a request