Background: I have a .Net 3.5 WPF \"Prism\"-based application running on Windows XP and Windows PosReady 2009 PCs. The app runs on PCs that are shut down every
Try a global Error catch and see what it produces.
public partial class App : Application
{
[STAThread]
public static void Main()
{
var application = new App();
application.DispatcherUnhandledException +=
new DispatcherUnhandledExceptionEventHandler(application_DispatcherUnhandledException);
application.InitializeComponent();
application.Run();
}
static void application_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
LogAndClose("Global exception: " + e.Exception.ToString());
}
public static void Log(string text)
{
try
{
System.IO.File.AppendAllText(Environment.CurrentDirectory + "\\Log.txt",
"[" + DateTime.Now.ToString("MM/dd/yy HH:mm:ss") + "] " + text + "\r\n");
}
catch { }
}
public static void LogAndClose(string text)
{
Log(text);
try
{
Application.Current.Shutdown();
}
catch { }
}
}