static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] [SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.ControlAppDomain)] static void Main() { #region Capturnig unhandled exceptions //Generate detailed information about an exception var GetExceptionDetails = new Func<Exception,string>(ex=> { string result = ""; result += "Source of the error: " + ex.Source; result += "\nStack trace: " + ex.StackTrace; result += "\nError message: " + ex.Message; return result; }); // Set the unhandled exception mode to force all Windows Forms errors to go through // our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += delegate(object sender, System.Threading.ThreadExceptionEventArgs e) { Library.Data.Logger.AddState("An error has been occured",GetExceptionDetails(e.Exception) ); }; // Add the event handler for handling non-UI thread exceptions to the event. AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs e) { Library.Data.Logger.AddState("An error has been occured",GetExceptionDetails((Exception)e.ExceptionObject)); }; #endregion Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Forms.SplashForm()); } }
public class SplashFor:Form { public SplashForm() { int i = 6/int.Parse("0"); } }
Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException)
int i = 6/int.Parse("0");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)