问题
I want to ensure that I am aware if my team introduces data binding errors within our Windows 10 UWP apps that we are building. XAML data binding errors have silently failed (for better or for worse) since the beginning days of WPF. There were imperative ways to hook onto data bindings available in .NET but that's not what I'm looking for as I want to be able to use declarative (XAML-based data bindings). I'm looking for a global hook kind of like the "UnhandledException" event in App.xaml.cs that would allow me to call TelemetryClient.TrackException(...).
回答1:
You could probably use DebugSettings.BindingFailed event
, see https://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.debugsettings
回答2:
you could probably use a combination of this: https://msdn.microsoft.com/en-us/library/system.diagnostics.presentationtracesources.aspx
to turn on diagnostic output for bindings, and this: http://www.nuget.org/packages/Microsoft.ApplicationInsights.TraceListener
to get that trace output to AI?
来源:https://stackoverflow.com/questions/33327271/how-to-log-data-binding-exceptions-in-windows-10-uwp-apps-using-application-insi