How to log data binding exceptions in Windows 10 UWP apps using Application Insights?

孤者浪人 提交于 2019-12-10 18:27:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!