dotnet/wpf · error · ValueUnavailableException
SR.Format(SR.BindingGroup_NoEntry, item, propertyName)
Error message
SR.Format(SR.BindingGroup_NoEntry, item, propertyName)
What it means
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.
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.
Example fix
// before
object value = bindingGroup.GetValue(item, "OrderTotal");
// after
object value;
if (!bindingGroup.TryGetValue(item, "OrderTotal", out value))
return; // no entry for this item/property Defensive patterns
Strategy: validation
Validate before calling
if (!bindingGroup.Items.Contains(item) ||
!bindingGroup.BindingExpressions.Any(be => be.TargetProperty.Name == propertyName))
return; // no entry — skip GetValue Try / catch
try { var v = bindingGroup.GetValue(item, propName); }
catch (ValueUnavailableException ex)
{
// entry missing or value unavailable; handle gracefully
} Prevention
- Prefer TryGetValue over GetValue in validation rules
- Verify property names against actual bindings
- Confirm items come from the group's Items collection
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- SR.Format(SR.BindingGroup_ValueUnavailable, item…
- Bracket characters cannot be alpha-numeric or whitespace.
- Bracket characters cannot be one of the following: '=' …
- Cannot have empty collection of DocumentPageView objects.
- InvalidDrawingAttributesWidth
AI-assisted analysis of dotnet/wpf@81131a70a4 (2026-09-14).
Data as JSON: /api/errors/32aad6f3dadf2bc6.
Report an issue: GitHub.
Appendix: source
Thrown at src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Data/BindingGroup.cs:457
/// the value is not available. This could be because an earlier validation
/// rule deemed the value invalid, or because the value could not be produced
/// for some reason, such as conversion failure.
/// </exception>
/// <Remarks>
/// This method is intended to be called from a validation rule, during
/// its Validate method.
/// </Remarks>
public object GetValue(object item, string propertyName)
{
object value;
if (TryGetValueImpl(item, propertyName, out value))
{
return value;
}
if (value == Binding.DoNothing)
throw new ValueUnavailableException(SR.Format(SR.BindingGroup_NoEntry, item, propertyName));
else
throw new ValueUnavailableException(SR.Format(SR.BindingGroup_ValueUnavailable, item, propertyName));
}
/// <summary>
/// Find the binding that uses the given item and property, and return
/// the value appropriate to the current validation step.
/// </summary>
/// <returns>
/// The method normally returns true and sets 'value' to the requested value.
/// If the value is not available, the method returns false and sets 'value'
/// to DependencyProperty.UnsetValue.
/// </returns>
/// <Remarks>
/// This method is intended to be called from a validation rule, during
/// its Validate method.
/// </Remarks>
public bool TryGetValue(object item, string propertyName, out object value)View on GitHub (pinned to 81131a70a4)