Search code examples
c#wpfdata-bindingconsole

How to silence Console Output from AutomationProperties Messages


My Output is filled with rows of errors/warning that from what I can tell from my research everyone just ignores. (Sample pasted bellow). I've done a little digging and I think the culprit is AutomationProperties. I've learned a lot for the next time I need to develop an accessible application but for this one I don't need LabeledBy,HelpText,...

Assuming I'm right with my analysis that AutomationProperties is causing these outputs. How do I go about silencing/muting/[Render unable to output to console].

I'm trying to clean up my output so that when my application writes to console I'm not required to dig through 95% of identical rows that will "always" be ignored.

As a general question - How do you silence things polluting the output (useful information not needed for current project).

System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is 'TextBox' (Name='PART_EditableTextBox'); target property is 'Name' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is 'TextBox' (Name='PART_EditableTextBox'); target property is 'LabeledBy' (type 'UIElement')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is 'TextBox' (Name='PART_EditableTextBox'); target property is 'HelpText' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=IsEditable; DataItem=null; target element is 'ToggleButton' (Name='toggleButton'); target property is 'NoTarget' (type 'Object')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is 'TextBox' (Name='PART_EditableTextBox'); target property is 'Name' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is 'TextBox' (Name='PART_EditableTextBox'); target property is 'LabeledBy' (type 'UIElement')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=(0); DataItem=null; target element is 'TextBox' (Name='PART_EditableTextBox'); target property is 'HelpText' (type 'String')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=IsEditable; DataItem=null; target element is 'ToggleButton' (Name='toggleButton'); target property is 'NoTarget' (type 'Object')

Solution

  • Oddly following the steps to Display WPF Trace Information solved my issue.

    I don't know why the instructions say to turn off the settings you want but it solved my issue:

    Under WPF Trace Settings, click the category of settings that you want to enable (for example, Data Binding).

    A drop-down list control appears in the Settings column next to Data Binding or whatever category you clicked.

    Click the drop-down list and select Off.

    It didn't solve the problem of trying to display the Tree but it did solve the issue I had in the post: My output being littered with "harmless" lines of text.

    If you want to hide the problem I'd recommend this step. If you want to resolve the issue I would recommend the link provided by @"Olivier Rogier" Lots of unexpected “Cannot retrieve value using the binding” errors or the link found in the answer of that link Resolving harmless binding errors in WPF. I hope this answer helps someone. Thank you @Olivier for you help.