dotnet/aspnetcore · error · InvalidOperationException

' ' is flagged with SingleDelivery, but the selected…

Error message

'{0}' is flagged with SingleDelivery, but the selected supplier '{1}' is not flagged with IsFixed

What it means

Thrown by CascadingParameterState when a cascading parameter is marked SingleDelivery (delivered to exactly one recipient) but the matched supplier is not IsFixed. There is no supported scenario for a non-fixed single-delivery supplier, since subscribing/unsubscribing would be ambiguous; the combination is disallowed to surface a misuse early.

Solutions

  1. Make the matching supplier IsFixed=true so the value is delivered once and never updates.
  2. Or set SingleDelivery=false on the custom attribute to allow normal multi-delivery subscription semantics.
  3. If you need both single-delivery and updates, redesign: the supported matrix excludes that combination.

Example fix

// before: SingleDelivery with a non-fixed supplier
public class MyCascadingValueSupplier : ICascadingValueSupplier
{
    public bool IsFixed => false; // triggers the throw
}
[MyCascadingParameter(SingleDelivery = true)] public string? Value { get; set; }

// after: fixed supplier matches single-delivery contract
public class MyCascadingValueSupplier : ICascadingValueSupplier
{
    public bool IsFixed => true;
}
Defensive patterns

Strategy: validation

Validate before calling

// When authoring a custom cascading parameter attribute, ensure the paired supplier is IsFixed if SingleDelivery is true.
if (attribute.SingleDelivery && !supplier.IsFixed) { throw new InvalidOperationException("Pair SingleDelivery with IsFixed."); }

Prevention

When it happens

Trigger: A custom CascadingParameterAttributeBase subclass declares SingleDelivery=true and is matched against an ICascadingValueSupplier whose IsFixed is false. The stock CascadingParameterAttribute is multi-delivery; this only arises from a custom attribute/supplier pair.

Common situations: Writing a custom cascading parameter attribute (advanced) that sets SingleDelivery and pairing it with a supplier that updates over time (IsFixed=false); copying a supplier implementation that is not marked fixed into a single-delivery scenario.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/dd0ad917378321df. Report an issue: GitHub.

Appendix: source

Thrown at src/Components/Components/src/CascadingParameterState.cs:67

        for (var infoIndex = 0; infoIndex < numInfos; infoIndex++)
        {
            ref var info = ref infos[infoIndex];
            var supplier = GetMatchingCascadingValueSupplier(info, componentState.Renderer, componentState.LogicalParentComponentState);
            if (supplier != null)
            {
                // Although not all parameters might be matched, we know the maximum number
                resultStates ??= new List<CascadingParameterState>(infos.Length - infoIndex);
                resultStates.Add(new CascadingParameterState(info, supplier, componentState));

                if (info.Attribute.SingleDelivery)
                {
                    hasSingleDeliveryParameters = true;
                    if (!supplier.IsFixed)
                    {
                        // We don't have a use case for IsFixed=false with SingleDelivery=true. To avoid complications about
                        // subscribing/unsubscribing in this case, just disallow it. It shouldn't be possible for this to
                        // occur unless someone creates their own CascadingParameterAttributeBase subclass.
                        throw new InvalidOperationException($"'{info.Attribute.GetType()}' is flagged with SingleDelivery, but the selected supplier '{supplier.GetType()}' is not flagged with {nameof(ICascadingValueSupplier.IsFixed)}");
                    }
                }
            }
        }

        return resultStates ?? (IReadOnlyList<CascadingParameterState>)Array.Empty<CascadingParameterState>();
    }

    internal static ICascadingValueSupplier? GetMatchingCascadingValueSupplier(in CascadingParameterInfo info, Renderer renderer, ComponentState? componentState)
    {
        // First scan up through the component hierarchy
        var candidate = componentState;
        while (candidate is not null)
        {
            if (candidate.Component is ICascadingValueSupplier valueSupplier && valueSupplier.CanSupplyValue(info))
            {
                return valueSupplier;
            }

View on GitHub (pinned to 3600ca084e)