dotnet/wpf · error · InvalidOperationException
SR.ValidationRule_UnknownStep (formatted with…
Error message
SR.ValidationRule_UnknownStep (formatted with validationStep, bindingGroup)
What it means
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.
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
Example fix
// before rule.ValidationStep = (ValidationStep)99; // after rule.ValidationStep = ValidationStep.ConvertedProposedValue;
Defensive patterns
Strategy: validation
Validate before calling
bool knownStep = step is ValidationStep.RawProposedValue or ValidationStep.ConvertedProposedValue or ValidationStep.UpdatedValue or ValidationStep.CommittedValue;
Type guard
bool IsValidStep(ValidationStep s) => s is ValidationStep.RawProposedValue or ValidationStep.ConvertedProposedValue or ValidationStep.UpdatedValue or ValidationStep.CommittedValue;
Try / catch
try { rule.Validate(value, culture); } catch (InvalidOperationException) { /* unknown ValidationStep; fix rule configuration */ } Prevention
- Only assign literal ValidationStep enum members
- Avoid enum casts/deserialization that can produce undefined values
- Keep WPF assemblies aligned so enum definitions match
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- InvalidEnumArgumentException("value", (int)value…
- SR.Storyboard_UnrecognizedHandoffBehavior
- SR.ValueInvalidForEnum
- ThemeMode value is invalid. Use None, System, Light or Dark
- Animation_UnrecognizedHandoffBehavior
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/f99cf0cb4632b69d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/MultiBindingExpression.cs:849
/// <summary>
/// Run validation rules for the given step, and inform the binding group
/// <summary>
internal override bool CheckValidationRules(BindingGroup bindingGroup, ValidationStep validationStep)
{
if (!NeedsValidation)
return true;
object value;
switch (validationStep)
{
case ValidationStep.RawProposedValue:
case ValidationStep.ConvertedProposedValue:
case ValidationStep.UpdatedValue:
case ValidationStep.CommittedValue:
value = bindingGroup.GetValue(this);
break;
default:
throw new InvalidOperationException(SR.Format(SR.ValidationRule_UnknownStep, validationStep, bindingGroup));
}
bool result = Validate(value, validationStep);
if (result && validationStep == ValidationStep.CommittedValue)
{
NeedsValidation = false;
}
return result;
}
/// <summary>
/// Get the proposed value(s) that would be written to the source(s), applying
/// conversion and checking UI-side validation rules.
/// </summary>
internal override bool ValidateAndConvertProposedValue(out Collection<ProposedValue> values)
{View on GitHub (pinned to 81131a70a4)