How to Include Breakpoint programmatically in Try Catch Block in Codes
This snippet shows how to force the running application to stops automatically when occurs an exception
-exclusively when in debug mode.
try { // your code to try } catch (Exception ex) { MessageBox.Show("Erro ao iniciar aplicativo: \n" + ex.Message + "\n" + ex.StackTrace); Console.WriteLine(DateTime.Now + " - Erro : " + ex.Message + "\nStackTrace:" + ex.StackTrace); #if DEBUG System.Diagnostics.Debugger.Break(); #endif }
Nice article
ReplyDelete