stride3d/stride · error · NodePresenterException

An error occurred while removing an item to the node, see…

Error message

An error occurred while removing an item to the node, see the inner exception for more information.

What it means

MemberNodePresenter.RemoveItem wraps the underlying node's Remove operation and rethrows any failure as a NodePresenterException with the original exception as InnerException. It signals that removing an item from the member node failed. Diagnose via the inner exception.

Solutions

  1. Read the InnerException to identify the underlying failure.
  2. Confirm the value/index still exists in the target collection before removal.
  3. Check that the target collection is not read-only or fixed-size.
  4. Refresh/rebuild the node presenter if the underlying model was replaced.

Example fix

// before
nodePresenter.RemoveItem(item, index); // throws if collection is read-only
// after
if (nodePresenter.Member.Target is IEnumerable && !(nodePresenter.Member.Target is System.Collections.IList list && list.IsReadOnly))
    nodePresenter.RemoveItem(item, index);
Defensive patterns

Strategy: try-catch

Validate before calling

if (nodePresenter?.Member?.Target == null || !nodePresenter.Member.Target.IsEnumerable)
    throw new InvalidOperationException("Target node is not enumerable; RemoveItem will fail.");

Type guard

static bool CanRemoveItem(MemberNodePresenter p, object value) =>
    p?.Member?.Target != null && p.Member.Target.IsEnumerable && value != null;

Try / catch

try
{
    nodePresenter.RemoveItem(value, index);
}
catch (NodePresenterException ex)
{
    logger.Error(ex.InnerException, "RemoveItem failed on member node");
}

Prevention

When it happens

Trigger: Calling MemberNodePresenter.RemoveItem(value, index) when Member.Target.Remove(value, index) throws — e.g. item not present, read-only collection, or the underlying model rejects the mutation.

Common situations: Deleting a list entry in the property grid whose backing collection is read-only or fixed-size; stale UI reference after the model was replaced; removal of an item already removed elsewhere.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/393941ce4f2290c9. Report an issue: GitHub.

Appendix: source

Thrown at sources/presentation/Stride.Core.Presentation.Quantum/Presenters/MemberNodePresenter.cs:135

        }
        catch (Exception e)
        {
            throw new NodePresenterException("An error occurred while adding an item to the node, see the inner exception for more information.", e);
        }
    }

    public override void RemoveItem(object value, NodeIndex index)
    {
        if (Member.Target == null || !Member.Target.IsEnumerable)
            throw new NodePresenterException($"{nameof(MemberNodePresenter)}.{nameof(RemoveItem)} cannot be invoked on members that are not collection.");

        try
        {
            Member.Target.Remove(value, index);
        }
        catch (Exception e)
        {
            throw new NodePresenterException("An error occurred while removing an item to the node, see the inner exception for more information.", e);
        }
    }

    public override NodeAccessor GetNodeAccessor()
    {
        return new NodeAccessor(Member, NodeIndex.Empty);
    }

    private void OnMemberChanging(object? sender, MemberNodeChangeEventArgs e)
    {
        RaiseValueChanging(Value);
        if (Member.Target != null)
        {
            Member.Target.ItemChanging -= OnItemChanging;
            Member.Target.ItemChanged -= OnItemChanged;
        }
    }

View on GitHub (pinned to 96fad776d2)