{"record":{"id":"d5f2edf311440cef","repo":"stride3d/stride","slug":"an-error-occurred-while-updating-the-value-of-the-node-see-d5f2ed","errorCode":null,"errorMessage":"An error occurred while updating the value of the node, see the inner exception for more information.","messagePattern":"An error occurred while updating the value of the node, see the inner exception for more information\\.","errorType":"exception","errorClass":"NodePresenterException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation.Quantum/Presenters/MemberNodePresenter.cs","lineNumber":90,"sourceCode":"    public override void UpdateValue(object newValue)\n    {\n        // Do not update member node presenter value to null if it does not allow null values (related to issue #668).\n        // FIXME With the obsoleting of Stride.Core.Annotations.NotNullAttribute, it might become partially broken.\n        //       Non-null members are no-longer annotated. \n        //\n        //       What are the failing use cases? Should we just check for value types here?\n        //       We could also decide to keep (non obsolete) NotNullAttribute just for that purpose.\n        //       For now, check for our NotNullAttribute as well as from CodeAnalysis\n        if ((newValue == null) && memberAttributes.Any(x => x is Annotations.NotNullAttribute or System.Diagnostics.CodeAnalysis.NotNullAttribute))\n            return;\n\n        try\n        {\n            Member.Update(newValue);\n        }\n        catch (Exception e)\n        {\n            throw new NodePresenterException(\"An error occurred while updating the value of the node, see the inner exception for more information.\", e);\n        }\n    }\n\n    public override void AddItem(object value)\n    {\n        if (Member.Target == null || !Member.Target.IsEnumerable)\n            throw new NodePresenterException($\"{nameof(MemberNodePresenter)}.{nameof(AddItem)} cannot be invoked on members that are not collection.\");\n\n        try\n        {\n            Member.Target.Add(value);\n        }\n        catch (Exception e)\n        {\n            throw new NodePresenterException(\"An error occurred while adding an item to the node, see the inner exception for more information.\", e);\n        }\n    }\n","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Quantum/Presenters/MemberNodePresenter.cs#L72-L108","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Catch NodePresenterException and read InnerException to see the setter's own exception or the reflection error.","Check MemberNodePresenter.IsReadOnly / MemberDescriptor.HasSet before calling UpdateValue; skip or disable the editor for read-only members.","Coerce/convert the new value to the member's Type before assignment (same type, or a registered converter).","Fix the throwing setter in the model if it rejects a legitimate value, or clamp/validate the input in the UI before updating."],"exampleFix":"// before\nmemberPresenter.UpdateValue(userInput); // raw string into int property -> ArgumentException\n// after\nif (memberPresenter.Descriptor.Type.IsInstanceOfType(converted))\n    memberPresenter.UpdateValue(converted);\nelse if (!int.TryParse(userInput, out var n))\n    return; // show validation error instead\nmemberPresenter.UpdateValue(n);","handlingStrategy":"try-catch","validationCode":"if (memberPresenter.IsReadOnly || !memberPresenter.MemberDescriptor.HasSet)\n    return; // cannot update\nif (newValue != null && !memberPresenter.Type.IsInstanceOfType(newValue))\n    newValue = System.Convert.ChangeType(newValue, memberPresenter.Type);\nif (newValue == null && memberPresenter.MemberAttributes.Any(a => a is Stride.Core.Annotations.NotNullAttribute))\n    return; // library ignores null for [NotNull] members anyway","typeGuard":"static bool CanUpdate(MemberNodePresenter m, object newValue)\n    => !m.IsReadOnly\n       && (newValue == null\n           || m.Type.IsInstanceOfType(newValue));","tryCatchPattern":"try\n{\n    memberPresenter.UpdateValue(newValue);\n}\ncatch (NodePresenterException ex)\n{\n    // ex.InnerException is usually the model setter's own exception or a reflection ArgumentException\n    ShowValidationError(ex.InnerException?.Message ?? ex.Message);\n}\nfinally\n{\n    memberPresenter.Refresh(); // resync UI with the actual model value\n}","preventionTips":["Check IsReadOnly/HasSet before editing and disable the UI control otherwise.","Convert user input to the member's exact Type before calling UpdateValue.","Remember null is silently ignored for [NotNull]-annotated members - don't rely on it throwing.","Wrap setter side effects (validation) so failures surface as InnerException you can show to the user."],"tags":["dotnet","stride","quantum","property-setter","wrapped-exception"],"backgroundTag":"invalid-argument-value","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}