I am looking for a method for the generally accepted method of catching exceptions created by getters of database properties (and setters, but performed without any special difficulties).
None of these events will catch the exceptions thrown by getters:
AppDomain.CurrentDomain.UnhandledException Application.Current.DispatcherUnhandledException Application.Current.Dispatcher.UnhandledException
Another idea is to use your own binding class with UpdateSourceExceptionFilter, as described in this thread . Unfortunately, this method only catches exceptions in property installers, not getters.
The last option I've seen is to use the PresentationTraceSources trace listener:
PresentationTraceSources.Refresh(); PresentationTraceSources.DataBindingSource.Listeners.Add(new PresentationLoggingTraceListener()); PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Error;
This method really does basically what I want. Unfortunately, this only gives me a string, not an exception, that is, I will have to figure out a bit of the actual error.
The TraceListener method will probably work in the end, but it seems a bit hacked. Are there any other options that I am missing, or am I pretty much stuck in TraceListener?
exception-handling wpf binding
Marty dill
source share