UIException.Start( string serverSmtp, int portSmtp, string passwdSmtp, string userSmtp, string programmerEmail, string fromEmail, string subject )
AppDomain.CurrentDomain.UnhandledException += (sender, e) => HandleError((Exception)e.ExceptionObject);
private static void HandleError(Exception exception) { try { // IErrorHandlerForm new ErrorHandlerController(exception, new ErrorHandlerForm()).Run(); } catch (Exception e) { // LogHelper.Logger.Error(e); // MessageBox.Show("Error processing exception. Please send log file " + LogHelper.ExceptionLogFileName + " to developer: " + Settings.ProgrammerEmail + " \r\n Exception:" + e); // if (MessageBox.Show("Attach debugger? \n Only for developer!!!", "Debugging...", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { Debugger.Launch(); throw; } } finally { // windows Environment.Exit(1); } }
public interface IErrorHandlerForm { event Action OnSendButtonClick; event Action OnShowErrorLinkClick; event Action OnLogFileLinkClick; event Action OnDebugButtonClick; // void SetHeight(int height); // string ExceptionInfoText { get; set; } // string ExceptionDetailText { get; set; } // email string ReplyEmail { get; } void ShowExceptionInfoTextBox(bool isShow); // void ShowInfoMessageBox( string text, string caption); // bool ShowQuestionDialog( string text, string caption); // ! finaly void ShowViewDialog(); void UpdateContactEmail(string contactEmail); }
private static void ConfigureNlog() { var config = new LoggingConfiguration(); var fileTarget = new FileTarget(); config.AddTarget("file", fileTarget); fileTarget.Layout = @"${longdate} ${message}"; fileTarget.FileName = "${basedir}/" + ExceptionLogFileName; var rule2 = new LoggingRule("*", LogLevel.Trace, fileTarget); config.LoggingRules.Add(rule2); LogManager.Configuration = config; }
if $(ConfigurationName) == Release ( "$(SolutionDir)ILMerge\ILMerge.exe" /out:"$(SolutionDir)Deploy\$(TargetFileName)" "$(TargetDir)*.dll" /target:dll /targetplatform:v4,C:\Windows\Microsoft.NET\Framework64\v4.0.30319 /wildcards )
Source: https://habr.com/ru/post/222163/
All Articles