visual-studionunitresharpernunit-3.0

NUnit async task fails "Method has non-void return value, but no result is expected"


I'm running unit tests in ReSharper with NUnit 3.10.

I'm getting this error when doing a simple async test:

Method has non-void return value, but no result is expected

My test is literally:

[Test]
public async Task Nothing()
{
    await Task.Delay(100);
}

It says in the documentation that this is in fact the correct way to run async tests.


Solution

  • For me the issues was that instead of using a NuGet package, the references were to a DLL that's compiled targeting .NET Framework 3.5. Using a NuGet package of NUnit fixed it.