0
votes

Please get me started on tracking down this error
Problem is that I bind to a lot of FieldValue and clearly not all are failing or I would be getting a lot more of these errors How do I n find the XAML binding that is throwing these warnings?
Does the hash point to a specific binding?

System.Windows.Data Warning: 56 : Created BindingExpression (hash=44291519) for Binding (hash=2717082)
System.Windows.Data Warning: 58 :   Path: 'FieldValue'
System.Windows.Data Warning: 56 : Created BindingExpression (hash=4012957) for Binding (hash=2717082)
System.Windows.Data Warning: 58 :   Path: 'FieldValue'
System.Windows.Data Warning: 62 : BindingExpression (hash=4012957): Attach to System.Windows.Controls.TextBox.Text (hash=30313526)
System.Windows.Data Warning: 67 : BindingExpression (hash=4012957): Resolving source 
System.Windows.Data Warning: 70 : BindingExpression (hash=4012957): Found data context element: TextBox (hash=30313526) (OK)
System.Windows.Data Warning: 78 : BindingExpression (hash=4012957): Activate with root item DocFieldDecimalSV (hash=12144638)
System.Windows.Data Warning: 107 : BindingExpression (hash=4012957):   At level 0 using cached accessor for DocFieldDecimalSV.FieldValue: RuntimePropertyInfo(FieldValue)
System.Windows.Data Warning: 104 : BindingExpression (hash=4012957): Replace item at level 0 with DocFieldDecimalSV (hash=12144638), using accessor RuntimePropertyInfo(FieldValue)
System.Windows.Data Warning: 101 : BindingExpression (hash=4012957): GetValue at level 0 from DocFieldDecimalSV (hash=12144638) using RuntimePropertyInfo(FieldValue): <null>
System.Windows.Data Warning: 80 : BindingExpression (hash=4012957): TransferValue - got raw value <null>
System.Windows.Data Warning: 82 : BindingExpression (hash=4012957): TransferValue - user's converter produced ''
System.Windows.Data Warning: 89 : BindingExpression (hash=4012957): TransferValue - using final value ''

I think I have tracked down
Get the call to Get and if the result is Decimal?(null) and then the errors to "got raw value "
Then it calls the converter
public object Convert(object value, Type targetType, object parameter,

CultureInfo culture)
{
    Debug.WriteLine("DecimalNullConverter Convert");
    Decimal? Decimal = (Decimal?)value;
    if (Decimal == null)
        return string.Empty;
    return Decimal.ToString();
}

Then the last two lines
So I think the binding just throws those errors before it calls the converted to get a String.Emply

So I think they are warning I can ignore

I really thought there would be a direct way to see what binding was throwing the warnings

1
Which version of Visual Studio are you using? - ΩmegaMan
the binding expression and the datacontext object would be nice - blindmeis
@blindmeis Yes that binding expression would be nice. My question is how do I find it? - paparazzo
did you write your xaml or not? create a sample project with this error and we can look at it - blindmeis
@blindmeis What? Just how am I supposed to write a program to recreate an error when I don't know where the error is coming from? I state I bind to FieldValue a lot and clearly not all all failing. - paparazzo

1 Answers

1
votes

Rework the converter(s) in question to default to the text "FAIL" which will be returned unless there is valid data to convert. Return the default text instead of string.empty and then visually find the problem.

If binding occurs at a point where it visually it is impossible to see the default text, set a breakpoint inside the convert and determine the control another way with either 1) possibly changing/using a multibinding converter with one of the items passed in the name of the control? or 2) Use/set the ConverterParameter and pass in an id to the convert to identify a particular control.

Or set a FallbackValue on the bindings to see if that may narrow down the list of possible textboxes.