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
- OS version, for example, Windows 10 or Mac OS X 10.8
- JetBrains Rider version: Help -> About
- Unit testing framework version, for example, xUnit 2.2.0
- MSBuild version: Settings -> Build, Execution, Deployment -> Toolset and Build (find screenshot below)
- .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
- Build your solution and then collect Rider logs: Help -> Collect Logs
- 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
- Attach the logs to the request
Additional information
- Sample solution where the issue reproduces is very much appreciated
- Can you see your unit tests in unit test explorer?
- Are there any steps to reproduce the issue?
- Has it worked in the previous version of JetBrains Rider?
Thank you for helping us make JetBrains Rider better!
Please sign in to leave a comment.
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.
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.

Thanks Kirill Filin that helped.
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.
For the BadImageFormatException, changing this setting to x64 seems to have fixed the problem.
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
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 :
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
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.

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)?
Adding Microsoft.NET.Test.Sdk solved the problem for me.
I was trying to use XUnit and FluentAssertions but the Microsoft package seems to be needed for Rider to recognize tests in your solution.