static void HandleUnhandledException(GLib.UnhandledExceptionArgs args) { Exception ex = args.ExceptionObject as Exception; string text = String.Format(Mono.Unix.Catalog.GetString("An unhandled exception has been thrown. Please, send this error report to your software maintainer in order to prevent more errors in the future.\n\n{0}: {1}\n{2}"), ex.InnerException.GetType().ToString(), ex.InnerException.Message.ToString(), ex.InnerException.StackTrace.ToString()); Gtk.MessageDialog msg = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, text); msg.UseMarkup = false; msg.Title = Mono.Unix.Catalog.GetString("Unhandled exception thrown in Secretaria Electrial"); if ((ResponseType)msg.Run() == ResponseType.Ok) { Emailer em = new Emailer(x => { }); em.Subject = "Unhandled exception thrown in Secretaria Electrial"; em.Body = text; em.Execute(); } msg.Destroy(); }