stride3d/stride · error · NodePresenterException

An error occurred while updating the value of the node, see

Error message

An error occurred while updating the value of the node, see the inner exception for more information.

What it means

MemberNodePresenter.UpdateValue wraps any exception thrown by Member.Update(newValue) in a NodePresenterException. Setting a member through Quantum ultimately assigns the backing property via reflection; any failure (setter throwing, wrong value type, read-only property) is funneled into this single exception with the root cause in InnerException. Note the library silently ignores null assignments to [NotNull]-annotated members, so this error comes from real setter failures.

Solutions

  1. Catch NodePresenterException and read InnerException to see the setter's own exception or the reflection error.
  2. Check MemberNodePresenter.IsReadOnly / MemberDescriptor.HasSet before calling UpdateValue; skip or disable the editor for read-only members.
  3. Coerce/convert the new value to the member's Type before assignment (same type, or a registered converter).
  4. Fix the throwing setter in the model if it rejects a legitimate value, or clamp/validate the input in the UI before updating.

Example fix

// before
memberPresenter.UpdateValue(userInput); // raw string into int property -> ArgumentException
// after
if (memberPresenter.Descriptor.Type.IsInstanceOfType(converted))
    memberPresenter.UpdateValue(converted);
else if (!int.TryParse(userInput, out var n))
    return; // show validation error instead
memberPresenter.UpdateValue(n);
Defensive patterns

Strategy: try-catch

Validate before calling

if (memberPresenter.IsReadOnly || !memberPresenter.MemberDescriptor.HasSet)
    return; // cannot update
if (newValue != null && !memberPresenter.Type.IsInstanceOfType(newValue))
    newValue = System.Convert.ChangeType(newValue, memberPresenter.Type);
if (newValue == null && memberPresenter.MemberAttributes.Any(a => a is Stride.Core.Annotations.NotNullAttribute))
    return; // library ignores null for [NotNull] members anyway

Type guard

static bool CanUpdate(MemberNodePresenter m, object newValue)
    => !m.IsReadOnly
       && (newValue == null
           || m.Type.IsInstanceOfType(newValue));

Try / catch

try
{
    memberPresenter.UpdateValue(newValue);
}
catch (NodePresenterException ex)
{
    // ex.InnerException is usually the model setter's own exception or a reflection ArgumentException
    ShowValidationError(ex.InnerException?.Message ?? ex.Message);
}
finally
{
    memberPresenter.Refresh(); // resync UI with the actual model value
}

Prevention

When it happens

Trigger: Calling MemberNodePresenter.UpdateValue(newValue) when: the member's property setter throws a user-defined validation exception, newValue's type is not assignable to the member type (ArgumentException from reflection), the property has no setter (HasSet == false / IsReadOnly), or a Quantum processor/observer attached to the node rejects the change.

Common situations: Property-grid edits where a model setter validates and throws (e.g. range checks); typing a string into an int field with a broken converter; trying to clear a non-nullable member to null; model class updated with a validating setter after a library version change.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

    public override void UpdateValue(object newValue)
    {
        // Do not update member node presenter value to null if it does not allow null values (related to issue #668).
        // FIXME With the obsoleting of Stride.Core.Annotations.NotNullAttribute, it might become partially broken.
        //       Non-null members are no-longer annotated. 
        //
        //       What are the failing use cases? Should we just check for value types here?
        //       We could also decide to keep (non obsolete) NotNullAttribute just for that purpose.
        //       For now, check for our NotNullAttribute as well as from CodeAnalysis
        if ((newValue == null) && memberAttributes.Any(x => x is Annotations.NotNullAttribute or System.Diagnostics.CodeAnalysis.NotNullAttribute))
            return;

        try
        {
            Member.Update(newValue);
        }
        catch (Exception e)
        {
            throw new NodePresenterException("An error occurred while updating the value of the node, see the inner exception for more information.", e);
        }
    }

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

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

View on GitHub (pinned to 96fad776d2)