{"record":{"id":"3559986a5342cdd5","repo":"stride3d/stride","slug":"an-error-occurred-while-updating-the-value-of-the-node-see","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/ItemNodePresenter.cs","lineNumber":69,"sourceCode":"    public override Type Type { get; }\n\n    public override bool IsEnumerable => Container.IsEnumerable;\n\n    public override ITypeDescriptor? Descriptor { get; }\n\n    public override object Value => Container.Retrieve(Index);\n\n    protected override IObjectNode? ParentingNode => Container.ItemReferences != null ? Container.IndexedTarget(Index) : null;\n\n    public override void UpdateValue(object newValue)\n    {\n        try\n        {\n            Container.Update(newValue, Index);\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 (Container.IndexedTarget(Index)?.IsEnumerable != true)\n            throw new NodePresenterException($\"{nameof(MemberNodePresenter)}.{nameof(AddItem)} cannot be invoked on members that are not collection.\");\n\n        try\n        {\n            Container.IndexedTarget(Index).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":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation.Quantum/Presenters/ItemNodePresenter.cs#L51-L87","documentation":"ItemNodePresenter.UpdateValue delegates the actual write to Container.Update(newValue, Index); any exception from the underlying node/property graph is wrapped in a NodePresenterException with a generic message and the original exception preserved as InnerException. It is a uniform error boundary so UI layers can handle node update failures consistently.","triggerScenarios":"Calling UpdateValue on an item node whose underlying member rejects the new value: a property setter throwing, a type-incompatible value, a read-only/collection constraint, or validation inside the object model failing during the update.","commonSituations":"Editing a property in Stride's Game Studio property grid with an invalid value (e.g. negative size, bad enum assignment); a script/component setter throwing; deserialized data in an inconsistent state; assigning a value of the wrong type to an indexed item.","solutions":["Inspect InnerException to find the root cause thrown by the property setter or node update","Validate the new value's type and constraints before assigning it via the node presenter","Fix the target property setter so it does not throw for legitimate values","Catch NodePresenterException at the UI layer and show the inner message to the user"],"exampleFix":"// before\nnodePresenter.UpdateValue(rawValue);\n// after\nif (nodePresenter.Type.IsInstanceOfType(rawValue))\n    nodePresenter.UpdateValue(rawValue);\nelse\n    Log.Warning($\"Cannot assign {rawValue?.GetType().Name} to {nodePresenter.Type.Name}\");","handlingStrategy":"try-catch","validationCode":"if (!nodePresenter.Type.IsInstanceOfType(newValue))\n    throw new ArgumentException($\"Value of type {newValue?.GetType()} is not assignable to {nodePresenter.Type}\");","typeGuard":"static bool CanAssign(INodePresenter node, object value) => value == null ? !node.Type.IsValueType : node.Type.IsInstanceOfType(value);","tryCatchPattern":"try { node.UpdateValue(newValue); } catch (NodePresenterException ex) { Log.Error(ex.InnerException, \"Node update failed\"); ShowError(ex.InnerException?.Message ?? ex.Message); }","preventionTips":["Always check InnerException — the outer message is intentionally generic","Validate value type and range constraints before UpdateValue","Keep property setters exception-free for valid inputs","Catch NodePresenterException at the property-grid layer and surface the root cause to the user"],"tags":["property-grid","reflection","exception-wrapping","stride"],"backgroundTag":"internal-invariant-violation","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"}