How can I turn binding errors into runtime exceptions?

前端 未结 2 2032
死守一世寂寞
死守一世寂寞 2020-11-28 07:29

Just as there is \"treat warning as errors\" set in our projects to catch early possible problems, I would love to have a runtime exception to catch them early.

I ha

2条回答
  •  無奈伤痛
    2020-11-28 07:44

    I implemented a solution very similar to the one proposed by Dean Chalk:

    1. Derived a TraceListener that throws instead of logging
    2. Added that listener to PresentationTraceSources.DataBindingSource

    Please see the complete solution on GitHub, it includes a demo application and a unit test project.

    Exception in Visual Studio

提交回复
热议问题