public static void _Main(string[] args)
{
Trace.WriteLine("start");
var logname = string.Format("{0}_{1}.{2}", "unhand", DateTime.Now.ToString("MMMdd-hhmmss-fffffff"), "log");
var listenerFile = new System.IO.FileInfo(logname);
listenerWriter = listenerFile.CreateText();
listener = new TextWriterTraceListener(listenerWriter);
Trace.Listeners.Add(listener);
//Trace.Listeners.Add(new TextWriterTraceListener(Console.Error));
Trace.AutoFlush = true;
AppDomain currentDomain = AppDomain.CurrentDomain;
currentDomain.UnhandledException += new UnhandledExceptionEventHandler(unhand_Handler);
try
{
Trace.WriteLine("throw 1");
throw new Exception("1");
}
catch (Exception e)
{
Trace.WriteLine($"Catch clause caught : {e.Message} \n");
}
Trace.WriteLine("throw 2");
throw new Exception("2");
//Trace.WriteLine("end");
}