WPF Binding Failure performance hit vs Exception

后端 未结 2 1697
攒了一身酷
攒了一身酷 2020-12-11 16:46

when we bind to heterogeneous collection of objects, not all objects have the same set of properties. in the output window we get a message like:

Syst

相关标签:
2条回答
  • 2020-12-11 17:18

    You're only seeing that output because you're running inside Visual Studio. Normally those trace statements go nowhere because there is no trace listener. Either way, the performance implications are completely negligible.

    Exceptions, on the other hand, would be a very costly way of reporting binding failures, particularly because - as you note - there are often bindings that work against some objects but not others.

    0 讨论(0)
  • 2020-12-11 17:27

    I haven't tested this myself but a blog post from the Visual Studio team says that binding errors indeed impact performance:

    WPF tries several different ways to resolve path errors, including searching for attached properties and this is quite expensive.

    0 讨论(0)
提交回复
热议问题