So I wrote this error logging class, to specs. It takes 3 objects as parameters, one for the exception, one for System.Relefect ion.MethodBase. GetCurrentMetho d(), and one for a Sql Data object (Data Adapter, Table Adapter, or SQL Command)... spawns a thread, saves info to a DB or dumps a strongly typed dataset to xml...
no worries.
BUT
Expand|Select|Wrap|Line Numbers
- try
- {
- ///Do Stuff....
- }
- catch (Exception Ex)
- {
- ErrorLogging.LogError(Ex, System.Reflection.MethodBase.GetCurrentMethod(), null);
- }
Is it possible to have some object watching a thread, suck in the relevant information (using Reflection, similar to how I am doing it now) and spawn a child/worker thread to do this? Then it just happens no matter where the exception is?
This would be a life saver (as well as helping migrate other apps to use this type of error logging). I would like to use it to prevent the app from job closing too if possible. If it traps an error, it should try to gracefully quit what it was doing and move on (button click, throws an error, it just discards what it was doing and ends the event)?