dotnet/aspnetcore · error · InvalidOperationException

'{0}' is flagged with SingleDelivery, but the selected suppl

Error message

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

What it means

Thrown by CascadingParameterState.FindCascadingParameters when a cascading parameter attribute has SingleDelivery=true (meaning it should only be delivered once and never updated) but the matched value supplier reports IsFixed=false. The framework has no use case for this combination because subscription/unsubscription bookkeeping for non-fixed suppliers on single-delivery parameters would be problematic. This only occurs when a developer creates a custom subclass of CascadingParameterAttributeBase with SingleDelivery=true.

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 294cab2f9b)

Solutions

  1. Make your custom ICascadingValueSupplier report IsFixed=true when paired with a SingleDelivery attribute.
  2. Use CascadingValueSource<T> constructed with isFixed:true.
  3. Do not set SingleDelivery=true on your custom attribute if the supplier is dynamic (non-fixed).

Example fix

// before
public class MyCascadingParameterAttribute : CascadingParameterAttributeBase
{
    public MyCascadingParameterAttribute() { SingleDelivery = true; }
}
// supplier reports IsFixed = false -> throws

// after — make the supplier fixed
public class MySupplier : ICascadingValueSupplier
{
    public bool IsFixed => true; // required for SingleDelivery attributes
}
Defensive patterns

Strategy: validation

Validate before calling

// For custom SingleDelivery attributes, verify supplier.IsFixed
if (attribute.SingleDelivery && supplier != null && !supplier.IsFixed)
    throw new InvalidOperationException("SingleDelivery requires a fixed supplier.");

Prevention

When it happens

Trigger: Creating a custom CascadingParameterAttributeBase subclass that sets SingleDelivery=true, then supplying it via a non-fixed ICascadingValueSupplier (e.g., a CascadingValue<T> with IsFixed=false, or a non-fixed CascadingValueSource<T>). The check is at CascadingParameterState.cs:59-68.

Common situations: Building a custom cascading parameter attribute for specialized DI-supplied values; library authors extending the cascading parameter system without making their supplier report IsFixed=true.

Related errors


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