Description
Versions:
Nuget packages:
NUnit 3.10.1
NUnit3TestAdapter 3.10.0
System.Threading.Tasks.Extensions 4.5.1
Environment:
Windows 10.1803 17134.286
Visual Studio 2017 15.8.4
Steps to Reproduce:
- Create C# Class Library, .NET 4.7.2
- Add Nuget references for NUnit, NUnit3TestAdapter and System.Threading.Tasks.Extensions
- Add Test Class:
using System.Threading.Tasks;
using NUnit.Framework;
namespace ClassLibrary1
{
public class Class1
{
[Test(/*ExpectedResult = 100*/)]
public async ValueTask<int> AsyncGetValueTest()
{
return await Task.FromResult(100);
}
}
}
- Run test "AsyncGetValueTest"
Expected Behavior:
NUnit says "Missed ExpectedResult in Test attribute" or "Test methods with return type ValueTask<> are not supported"
Actual Behavior:
NUnit fails with an internal error:
System.NullReferenceException : Object reference not set to an instance of an object.
at NUnit.Framework.Internal.AsyncInvocationRegion.AsyncTaskInvocationRegion.WaitForPendingOperationsToComplete(Object invocationResult)
at C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\AsyncInvocationRegion.cs:line 109
at NUnit.Framework.Internal.Commands.TestMethodCommand.RunAsyncTestMethod(TestExecutionContext context)
at C:\src\nunit\nunit\src\NUnitFramework\framework\Internal\Commands\TestMethodCommand.cs:line 96