{"record":{"id":"585615f2a2d557a3","repo":"dotnet/BenchmarkDotNet","slug":"default-benchmarkactionfactory-does-not-support-cu","errorCode":null,"errorMessage":"Default BenchmarkActionFactory does not support custom async enumerables besides IAsyncEnumerable<T> and ConfiguredCancelAsyncEnumerable<T>","messagePattern":"Default BenchmarkActionFactory does not support custom async enumerables besides IAsyncEnumerable<T> and ConfiguredCancelAsyncEnumerable<T>","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs","lineNumber":100,"sourceCode":"        {\n            var asyncEnumerableInterface = typeof(IAsyncEnumerable<>).MakeGenericType(asyncEnumerableInfo.ItemType);\n            if (asyncEnumerableInterface.IsAssignableFrom(resultType))\n            {\n                return Create(\n                    typeof(BenchmarkActionAsyncEnumerable<>).MakeGenericType(asyncEnumerableInfo.ItemType),\n                    resultInstance,\n                    targetMethod,\n                    unrollFactor);\n            }\n            if (resultType.IsGenericType && resultType.GetGenericTypeDefinition() == typeof(ConfiguredCancelableAsyncEnumerable<>))\n            {\n                return Create(\n                    typeof(BenchmarkActionConfiguredCancelableAsyncEnumerable<>).MakeGenericType(asyncEnumerableInfo.ItemType),\n                    resultInstance,\n                    targetMethod,\n                    unrollFactor);\n            }\n            throw new NotSupportedException(\n                $\"Default {nameof(BenchmarkActionFactory)} does not support custom async enumerables besides IAsyncEnumerable<T> and ConfiguredCancelableAsyncEnumerable<T>\");\n        }\n\n        return Create(\n            typeof(BenchmarkAction<>).MakeGenericType(resultType),\n            resultInstance,\n            targetMethod,\n            unrollFactor);\n    }\n\n    private static void PrepareInstanceAndResultType(object instance, MethodInfo targetMethod, out object? resultInstance, out Type resultType)\n    {\n        resultInstance = targetMethod.IsStatic ? null : instance;\n        resultType = targetMethod.ReturnType;\n\n        if (resultType == typeof(void))\n        {\n            // DONTTOUCH: async should be checked for target method","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/dotnet/BenchmarkDotNet/blob/b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3/src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs#L82-L118","documentation":"The default InProcess NoEmit BenchmarkActionFactory supports consuming IAsyncEnumerable<T> and ConfiguredCancelAsyncEnumerable<T> only; other custom async enumerable types are rejected.","triggerScenarios":"Thrown at src/BenchmarkDotNet/Toolchains/InProcess/NoEmit/BenchmarkActionFactory.cs:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Return IAsyncEnumerable<T> (or ConfiguredCancelAsyncEnumerable<T>) from the benchmark instead of a custom async enumerable.","Implement a custom BenchmarkActionFactory that knows how to consume your async enumerable type.","Use the default out-of-process toolchain if you cannot change the return type."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b515068b61ad1c9c9aa938b8ece4af1e7d6d85a3","analyzedAt":"2026-08-13T19:12:24.196Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}