{"record":{"id":"c24a6105621b47c8","repo":"dotnet/wpf","slug":"sr-format-sr-bindinggroup-valueunavailable-item-propertyname","errorCode":null,"errorMessage":"SR.Format(SR.BindingGroup_ValueUnavailable, item, propertyName)","messagePattern":"SR\\.Format\\(SR\\.BindingGroup_ValueUnavailable, item, propertyName\\)","errorType":"exception","errorClass":"ValueUnavailableException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingGroup.cs","lineNumber":459,"sourceCode":"        /// for some reason, such as conversion failure.\n        /// </exception>\n        /// <Remarks>\n        /// This method is intended to be called from a validation rule, during\n        /// its Validate method.\n        /// </Remarks>\n        public object GetValue(object item, string propertyName)\n        {\n            object value;\n\n            if (TryGetValueImpl(item, propertyName, out value))\n            {\n                return value;\n            }\n\n            if (value == Binding.DoNothing)\n                throw new ValueUnavailableException(SR.Format(SR.BindingGroup_NoEntry, item, propertyName));\n            else\n                throw new ValueUnavailableException(SR.Format(SR.BindingGroup_ValueUnavailable, item, propertyName));\n        }\n\n        /// <summary>\n        /// Find the binding that uses the given item and property, and return\n        /// the value appropriate to the current validation step.\n        /// </summary>\n        /// <returns>\n        /// The method normally returns true and sets 'value' to the requested value.\n        /// If the value is not available, the method returns false and sets 'value'\n        /// to DependencyProperty.UnsetValue.\n        /// </returns>\n        /// <Remarks>\n        /// This method is intended to be called from a validation rule, during\n        /// its Validate method.\n        /// </Remarks>\n        public bool TryGetValue(object item, string propertyName, out object value)\n        {\n            bool result = TryGetValueImpl(item, propertyName, out value);","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingGroup.cs#L441-L477","documentation":"BindingGroup.GetValue throws this ValueUnavailableException when the (item, propertyName) pair exists in the group's bookkeeping but its value cannot be provided for the current validation step — the internal lookup returned Binding.DoNothing sentinel meaning 'entry present, value unavailable'. This is the sibling case of BindingGroup_NoEntry: the binding exists but produced no value.","triggerScenarios":"Calling BindingGroup.GetValue(item, propertyName) during validation/commit when the binding's value is not yet available (e.g. the binding returned Binding.DoNothing from a converter, or the source value cannot be resolved at the current UpdateSourceTrigger stage).","commonSituations":"Custom ValidationRules that call GetValue during UpdateSource phase before the value has propagated; converters returning Binding.DoNothing deliberately; bindings with deferred value transfers (e.g. UpdateSourceTrigger=Explicit) evaluated too early.","solutions":["Use TryGetValue and treat a false return as 'value not ready yet' rather than an error.","Check BindingGroup.ValidateWithoutUpdate vs UpdateSources timing — only read values at the validation stage where they are expected.","If a converter returns Binding.DoNothing, ensure downstream validation rules do not require a value for that property."],"exampleFix":"// before\nobject v = bindingGroup.GetValue(item, \"StartDate\"); // throws if unavailable\n\n// after\nif (bindingGroup.TryGetValue(item, \"StartDate\", out var v))\n{\n    // validate v\n}","handlingStrategy":"try-catch","validationCode":"object probe;\nbool available = bindingGroup.TryGetValue(item, propertyName, out probe);","typeGuard":null,"tryCatchPattern":"try { var v = bindingGroup.GetValue(item, propName); Validate(v); }\ncatch (ValueUnavailableException)\n{\n    // value not yet available at this validation step; defer\n}","preventionTips":["Use TryGetValue in custom ValidationRules","Do not call GetValue for properties whose converters return Binding.DoNothing","Read values only at the validation stage where they exist"],"tags":["wpf","binding-group","validation","value-unavailable"],"backgroundTag":"entity-not-found","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"}