dotnet/reactive · error · ArgumentNullException

Value cannot be null. (Parameter 'task')

Error message

Value cannot be null. (Parameter 'task')

What it means

This RendezVous overload moves the continuation of an already-started Task onto the given scheduler; a null task leaves nothing to await. The method's null guard throws before constructing the TaskAwaitable. Fix: pass the Task you intend to reschedule, not null.

Solutions

  1. Pass the actual Task produced by the async operation instead of null.
  2. Ensure the expression returning the task is not a void-returning or uninitialized helper.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at AsyncRx.NET/System.Reactive.Async/Concurrency/AsyncScheduler.cs:27 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dotnet/reactive@94b5d5ab91 (2026-09-15). Data as JSON: /api/errors/00a795ae6c7c94dc. Report an issue: GitHub.

Appendix: source

Thrown at AsyncRx.NET/System.Reactive.Async/Concurrency/AsyncScheduler.cs:27

namespace System.Reactive.Concurrency
{
    public static class AsyncScheduler
    {
        public static RendezVousAwaitable RendezVous(this IAsyncScheduler scheduler, CancellationToken token = default)
        {
            if (scheduler == null)
                throw new ArgumentNullException(nameof(scheduler));

            token.ThrowIfCancellationRequested();

            return new RendezVousAwaitable(scheduler, token);
        }

        public static TaskAwaitable RendezVous(this Task task, IAsyncScheduler scheduler, CancellationToken token = default)
        {
            if (task == null)
                throw new ArgumentNullException(nameof(task));
            if (scheduler == null)
                throw new ArgumentNullException(nameof(scheduler));

            return new TaskAwaitable(task, continueOnCapturedContext: false, scheduler, token);
        }

        public static TaskAwaitable<T> RendezVous<T>(this Task<T> task, IAsyncScheduler scheduler, CancellationToken token = default)
        {
            if (task == null)
                throw new ArgumentNullException(nameof(task));
            if (scheduler == null)
                throw new ArgumentNullException(nameof(scheduler));

            return new TaskAwaitable<T>(task, continueOnCapturedContext: false, scheduler, token);
        }

        public static ValueTaskAwaitable RendezVous(this ValueTask task, IAsyncScheduler scheduler, CancellationToken token = default)
        {

View on GitHub (pinned to 94b5d5ab91)