dotnet/aspnetcore · error · InvalidOperationException
Cannot notify about changes because the {GetType()} is confi
Error message
Cannot notify about changes because the {GetType()} is configured as fixed. What it means
Thrown by CascadingValueSource<TValue>.NotifyChangedAsync when the source was constructed with isFixed=true. A fixed cascading value is an optimization that skips subscriber registration entirely, so there are no subscribers to notify. Calling NotifyChangedAsync on a fixed source is a logic error — the value was declared immutable.
Source
Thrown at src/Components/Components/src/CascadingValueSource.cs:89
private CascadingValueSource(bool isFixed)
{
_isFixed = isFixed;
if (!_isFixed)
{
_subscribers = new();
}
}
/// <summary>
/// Notifies subscribers that the value has changed (for example, if it has been mutated).
/// </summary>
/// <returns>A <see cref="Task"/> that completes when the notifications have been issued.</returns>
public Task NotifyChangedAsync()
{
if (_isFixed)
{
throw new InvalidOperationException($"Cannot notify about changes because the {GetType()} is configured as fixed.");
}
if (_subscribers?.Count > 0)
{
var tasks = new List<Task>();
foreach (var (dispatcher, subscribers) in _subscribers)
{
tasks.Add(dispatcher.InvokeAsync(() =>
{
var subscribersBuffer = new ComponentStateBuffer();
var subscribersCount = subscribers.Count;
var subscribersCopy = subscribersCount <= ComponentStateBuffer.Capacity
? subscribersBuffer[..subscribersCount]
: new ComponentState[subscribersCount];
subscribers.CopyTo(subscribersCopy);
// We iterate over a copy of the list because new subscribers might getView on GitHub (pinned to 294cab2f9b)
Solutions
- Reconstruct/register the CascadingValueSource with isFixed:false if the value needs to change.
- Gate the NotifyChangedAsync call behind a check of whether the source is fixed.
- If the value is genuinely immutable, remove the NotifyChangedAsync call.
Example fix
// before var source = new CascadingValueSource<MyType>(_initial, isFixed: true); services.Add(new CascadingValueSource<MyType>(source)); await source.NotifyChangedAsync(_updated); // throws // after var source = new CascadingValueSource<MyType>(_initial, isFixed: false); services.Add(new CascadingValueSource<MyType>(source)); await source.NotifyChangedAsync(_updated);
Defensive patterns
Strategy: validation
Validate before calling
if (((ICascadingValueSupplier)source).IsFixed)
throw new InvalidOperationException("Cannot call NotifyChangedAsync on a fixed source."); Type guard
static bool CanNotify<T>(CascadingValueSource<T> source)
=> !((ICascadingValueSupplier)source).IsFixed; Prevention
- Construct CascadingValueSource with isFixed:false if you intend to call NotifyChangedAsync.
- Store a flag alongside the source indicating whether notifications are allowed.
When it happens
Trigger: Calling NotifyChangedAsync() or NotifyChangedAsync(newValue) on a CascadingValueSource that was created with isFixed:true. The guard is at CascadingValueSource.cs:87-90.
Common situations: Registering a cascading value source as fixed in DI for performance, then later deciding the value should update and calling NotifyChangedAsync without changing the construction; copy-pasting from a dynamic source to a fixed one.
Related errors
- The parameter '{nameof(Name)}' for component '{nameof(Cascad
- The component activator returned a null value for a componen
- EqualTo validator requires a non-empty "other" parameter.
- FileExtensions validator requires a non-empty "extensions" p
- Range validator requires at least one of "min" or "max" para
AI-assisted analysis of dotnet/aspnetcore@294cab2f9b (2026-08-06).
Data as JSON: /api/errors/da48d3cee1cc3869.
Report an issue: GitHub.