{"record":{"id":"f99cf0cb4632b69d","repo":"dotnet/wpf","slug":"sr-validationrule-unknownstep-formatted-with-validationstep","errorCode":null,"errorMessage":"SR.ValidationRule_UnknownStep (formatted with validationStep, bindingGroup)","messagePattern":"SR\\.ValidationRule_UnknownStep \\(formatted with validationStep, bindingGroup\\)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBindingExpression.cs","lineNumber":849,"sourceCode":"    /// <summary>\n    /// Run validation rules for the given step, and inform the binding group\n    /// <summary>\n    internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)\n    {\n        if (!NeedsValidation)\n            return true;\n\n        object value;\n        switch (validationStep)\n        {\n            case ValidationStep.RawProposedValue:\n            case ValidationStep.ConvertedProposedValue:\n            case ValidationStep.UpdatedValue:\n            case ValidationStep.CommittedValue:\n                value = bindingGroup.GetValue(this);\n                break;\n            default:\n                throw new InvalidOperationException(SR.Format(SR.ValidationRule_UnknownStep, validationStep, bindingGroup));\n        }\n\n        bool result = Validate(value, validationStep);\n\n        if (result && validationStep == ValidationStep.CommittedValue)\n        {\n            NeedsValidation = false;\n        }\n\n        return result;\n    }\n\n    /// <summary>\n    /// Get the proposed value(s) that would be written to the source(s), applying\n    /// conversion and checking UI-side validation rules.\n    /// </summary>\n    internal override bool ValidateAndConvertProposedValue(out Collection<ProposedValue> values)\n    {","sourceCodeStart":831,"sourceCodeEnd":867,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBindingExpression.cs#L831-L867","documentation":"During validation (ValidateWithoutUpdate / validation evaluation), MultiBindingExpression throws InvalidOperationException when the ValidationStep has an unrecognized value not covered by RawProposedValue, ConvertedProposedValue, UpdatedValue, or CommittedValue. This is effectively an internal invariant check against a corrupted or future ValidationStep enum value.","triggerScenarios":"A ValidationRule whose ValidationStep property was set to an out-of-range/unknown value (e.g. invalid cast, hand-built enum value) and then evaluated against the MultiBindingExpression/bindingGroup.","commonSituations":"Manually constructing ValidationStep values via unsafe casts; deserialization producing a value not present in the current enum; framework-version mismatch where new enum members are evaluated by older code paths.","solutions":["Set ValidationRule.ValidationStep to a valid enum member (RawProposedValue, ConvertedProposedValue, UpdatedValue, or CommittedValue)","Remove or fix rules with invalid ValidationStep values before the binding evaluates","Verify assembly/runtime versions match so the ValidationStep enum is consistent"],"exampleFix":"// before\nrule.ValidationStep = (ValidationStep)99;\n// after\nrule.ValidationStep = ValidationStep.ConvertedProposedValue;","handlingStrategy":"validation","validationCode":"bool knownStep = step is ValidationStep.RawProposedValue or ValidationStep.ConvertedProposedValue or ValidationStep.UpdatedValue or ValidationStep.CommittedValue;","typeGuard":"bool IsValidStep(ValidationStep s) => s is ValidationStep.RawProposedValue or ValidationStep.ConvertedProposedValue or ValidationStep.UpdatedValue or ValidationStep.CommittedValue;","tryCatchPattern":"try { rule.Validate(value, culture); } catch (InvalidOperationException) { /* unknown ValidationStep; fix rule configuration */ }","preventionTips":["Only assign literal ValidationStep enum members","Avoid enum casts/deserialization that can produce undefined values","Keep WPF assemblies aligned so enum definitions match"],"tags":["wpf","validation","multibinding","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}