You are designing a complex and critical Windows desktop application by using Microsoft .NET Framework 4 and Microsoft Visual Studio 2010.
You plan to implement a logging strategy for the application.
You need to record all unexpected errors that occur in the application.
What should you do?
A.
Subscribe to the unhandled exception event handler for the AppDomain object.
Record relevant application-specific information to an external log.
B.
Subscribe to the unhandled exception event handler for the application’s dispatcher on the main application thread.
Record relevant application-specific information to an external log.
C.
Create a generic catch (Exception e) block in the Main method of the application.
Record relevant application-specific information to a log in the Main method.
D.
Create a global WIN 32 unhandled exception filter.
Record relevant application-specific information to an external log from within the filter.
According to blog of Ivan Krivyakov about this topic (http://www.ikriv.com/blog/?p=1440) I’m confused between A and D. However I’ve found this statement about Win32 filter in other blog: “The problem with this approach is that you probably don’t have access to a useful CLR traceback.” (http://freshfoo.com/blog/dotnet_exceptions.1024px) which would prevent us from preparing good logging strategy. Hence the answer appears to be A.