{"record":{"id":"32aad6f3dadf2bc6","repo":"dotnet/wpf","slug":"sr-format-sr-bindinggroup-noentry-item-propertyname","errorCode":null,"errorMessage":"SR.Format(SR.BindingGroup_NoEntry, item, propertyName)","messagePattern":"SR\\.Format\\(SR\\.BindingGroup_NoEntry, item, propertyName\\)","errorType":"exception","errorClass":"ValueUnavailableException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingGroup.cs","lineNumber":457,"sourceCode":"        /// the value is not available.  This could be because an earlier validation\n        /// rule deemed the value invalid, or because the value could not be produced\n        /// 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)","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingGroup.cs#L439-L475","documentation":"BindingGroup.GetValue looks up the value for a given (item, propertyName) pair among the group's binding expressions. When TryGetValueImpl returns false but the internal sentinel value is Binding.DoNothing, the group distinguishes 'no entry exists at all' from 'value unavailable' and throws ValueUnavailableException with the BindingGroup_NoEntry message, indicating that no binding in the group corresponds to the requested item/property pair.","triggerScenarios":"Calling BindingGroup.GetValue(item, propertyName) where the item is not bound by any BindingExpression in the group (no matching entry), i.e. the pair was never added via a binding or AddValue/commit path.","commonSituations":"Validation rules or IValueConverter code that assumes a property exists in the group but the binding was removed, renamed, or never created; typos in property names passed to GetValue; items obtained from a different collection than the group's items.","solutions":["Use TryGetValue(item, propertyName, out value) instead of GetValue and handle the false case.","Verify the exact property name and item instance passed in match a binding in the group (Items collection).","Enumerate BindingExpressions in the group to confirm the expected binding exists before calling GetValue."],"exampleFix":"// before\nobject value = bindingGroup.GetValue(item, \"OrderTotal\");\n\n// after\nobject value;\nif (!bindingGroup.TryGetValue(item, \"OrderTotal\", out value))\n    return; // no entry for this item/property","handlingStrategy":"validation","validationCode":"if (!bindingGroup.Items.Contains(item) ||\n    !bindingGroup.BindingExpressions.Any(be => be.TargetProperty.Name == propertyName))\n    return; // no entry — skip GetValue","typeGuard":null,"tryCatchPattern":"try { var v = bindingGroup.GetValue(item, propName); }\ncatch (ValueUnavailableException ex)\n{\n    // entry missing or value unavailable; handle gracefully\n}","preventionTips":["Prefer TryGetValue over GetValue in validation rules","Verify property names against actual bindings","Confirm items come from the group's Items collection"],"tags":["wpf","binding-group","validation","value-unavailable"],"backgroundTag":"record-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"}