{"record":{"id":"5904b145a9471188","repo":"stride3d/stride","slug":"this-method-must-be-invoked-with-at-least-one-property-name","errorCode":null,"errorMessage":"This method must be invoked with at least one property name.","messagePattern":"This method must be invoked with at least one property name\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"sources/presentation/Stride.Core.Presentation/ViewModels/EditableViewModel.cs","lineNumber":212,"sourceCode":"\n    protected virtual Operation CreatePropertyChangeOperation(string displayName, string propertyName, object? preEditValue)\n    {\n        var operation = new PropertyChangeOperation(propertyName, this, preEditValue, Dirtiables);\n        UndoRedoService.SetName(operation, displayName);\n        return operation;\n    }\n\n    protected virtual Operation CreateCollectionChangeOperation(string displayName, IList list, NotifyCollectionChangedEventArgs args)\n    {\n        var operation = new CollectionChangeOperation(list, args, Dirtiables);\n        UndoRedoService.SetName(operation, displayName);\n        return operation;\n    }\n\n    private bool SetValue<T>(ref T field, T value, Action? updateAction, bool createTransaction, params string[] propertyNames)\n    {\n        if (propertyNames.Length == 0)\n            throw new ArgumentOutOfRangeException(nameof(propertyNames), \"This method must be invoked with at least one property name.\");\n\n        if (!EqualityComparer<T>.Default.Equals(field, value))\n        {\n            ITransaction? transaction = null;\n            if (!UndoRedoService.UndoRedoInProgress && createTransaction)\n            {\n                transaction = UndoRedoService.CreateTransaction();\n                var concatPropertyName = string.Join(\", \", propertyNames.Where(x => !uncancellableChanges.Contains(x)).Select(s => $\"'{s}'\"));\n                UndoRedoService.SetName(transaction, $\"Update property {concatPropertyName}\");\n            }\n            try\n            {\n                return base.SetValue(ref field, value, updateAction, propertyNames);\n            }\n            finally\n            {\n                if (!UndoRedoService.UndoRedoInProgress && createTransaction)\n                {","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/presentation/Stride.Core.Presentation/ViewModels/EditableViewModel.cs#L194-L230","documentation":"The private SetValue<T>(ref field, ...) core setter requires at least one property name so the change can be broadcast and journaled. An empty params string[] is rejected with ArgumentOutOfRangeException before any mutation happens.","triggerScenarios":"Calling a public setter helper (e.g. SetValue<T>(ref T field, T value, ...) or Set/SetValue wrappers) with no property names, or forwarding a dynamically built propertyNames array that ended up empty.","commonSituations":"Programmatically constructing the params array from a collection that was empty; forgetting to pass the property name to a SetValue overload; refactoring that dropped the nameof(...) argument.","solutions":["Always pass at least one property name, typically nameof(MyProperty)","Validate the properties array is non-empty before forwarding","Default a missing name to the calling property via CallerMemberName where applicable","Add a debug assert at the public wrapper to fail fast in development"],"exampleFix":"// before\nSetValue(ref name, value); // throws: no property name\n// after\nSetValue(ref name, value, nameof(Name));","handlingStrategy":"validation","validationCode":"if (propertyNames == null || propertyNames.Length == 0)\n    throw new ArgumentException(\"At least one property name is required.\");","typeGuard":null,"tryCatchPattern":"try { vm.SetValue(ref field, value, propertyName); }\ncatch (ArgumentOutOfRangeException) { /* missing property name — fix call site */ }","preventionTips":["Always pass nameof(...) as the property name","Never forward possibly-empty arrays as params string[]"],"tags":["argument","viewmodel","validation","params"],"backgroundTag":"argument-out-of-range","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"}