dotnet/BenchmarkDotNet · error · NotSupportedException
Default BenchmarkActionFactory does not support returning aw
Error message
Default BenchmarkActionFactory does not support returning awaitable types except (Value)Task(<T>).
What it means
The default InProcess NoEmit BenchmarkActionFactory only knows how to await (Value)Task(<T>); benchmarks returning other awaitable types throw NotSupportedException.
Source
Thrown at src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs:78
? typeof(BenchmarkActionBlockingTask<>).MakeGenericType(argType)
: typeof(BenchmarkActionTask<>).MakeGenericType(argType),
resultInstance,
targetMethod,
unrollFactor);
if (typeof(ValueTask<>) == genericType)
return Create(
consumeTasksSynchronously
? typeof(BenchmarkActionBlockingValueTask<>).MakeGenericType(argType)
: typeof(BenchmarkActionValueTask<>).MakeGenericType(argType),
resultInstance,
targetMethod,
unrollFactor);
}
if (resultType.IsAwaitable(out _))
{
throw new NotSupportedException($"Default {nameof(BenchmarkActionFactory)} does not support returning awaitable types except (Value)Task(<T>).");
}
if (resultType.IsAsyncEnumerable(out var asyncEnumerableInfo))
{
var asyncEnumerableInterface = typeof(IAsyncEnumerable<>).MakeGenericType(asyncEnumerableInfo.ItemType);
if (asyncEnumerableInterface.IsAssignableFrom(resultType))
{
return Create(
typeof(BenchmarkActionAsyncEnumerable<>).MakeGenericType(asyncEnumerableInfo.ItemType),
resultInstance,
targetMethod,
unrollFactor);
}
if (resultType.IsGenericType && resultType.GetGenericTypeDefinition() == typeof(ConfiguredCancelableAsyncEnumerable<>))
{
return Create(
typeof(BenchmarkActionConfiguredCancelableAsyncEnumerable<>).MakeGenericType(asyncEnumerableInfo.ItemType),
resultInstance,View on GitHub (pinned to b515068b61)
Solutions
- Return Task, Task<T>, ValueTask, or ValueTask<T> from the async benchmark method.
- For other awaitable types, run the benchmark with the default out-of-process toolchain or provide a custom BenchmarkActionFactory.
When it happens
Trigger: Thrown at src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs:78 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of dotnet/BenchmarkDotNet@b515068b61 (2026-08-13).
Data as JSON: /api/errors/5dc4287e30b28d58.
Report an issue: GitHub.