test and try/catch when mime type is not known

This commit is contained in:
ziti-ci
2020-12-16 14:21:27 -05:00
parent 1204f9657e
commit 3a458810e5
2 changed files with 17 additions and 8 deletions
+14 -7
View File
@@ -300,13 +300,20 @@ namespace ZitiDesktopEdge
var closeMethod = mailWriter.GetType().GetMethod("Close", BindingFlags.Instance | BindingFlags.NonPublic);
closeMethod.Invoke(mailWriter, BindingFlags.Instance | BindingFlags.NonPublic, null, new object[] { }, null);
}
var p = Process.Start(emlFile);
p.Exited += (object lambdaSender, EventArgs lambdaEventArgs) => {
logger.Info("Removing temp file: {0}", emlFile);
File.Delete(emlFile);
};
p.EnableRaisingEvents = true;
try {
var p = Process.Start(emlFile);
if (p != null) {
p.Exited += (object lambdaSender, EventArgs lambdaEventArgs) => {
logger.Info("Removing temp file: {0}", emlFile);
File.Delete(emlFile);
};
p.EnableRaisingEvents = true;
} else {
logger.Debug("process was null. most likely the email file format was not known when the process tried to start");
}
} catch(Exception ex) {
logger.Warn(ex, "An unexpected error has occurred when submitting feedback? {0}", ex.Message);
}
}
private void ShowSupport(object sender, MouseButtonEventArgs e) {
+3 -1
View File
@@ -40,6 +40,8 @@ namespace ZitiDesktopEdge {
private static SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1, 1);
static System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
public static string ThisAssemblyName;
public static string ExecutionDirectory;
public static string ExpectedLogPathRoot;
@@ -47,7 +49,7 @@ namespace ZitiDesktopEdge {
public static string ExpectedLogPathServices;
static MainWindow() {
var asm = System.Reflection.Assembly.GetExecutingAssembly();
asm = System.Reflection.Assembly.GetExecutingAssembly();
ThisAssemblyName = asm.GetName().Name;
#if DEBUG
ExecutionDirectory = @"C:\Program Files (x86)\NetFoundry, Inc\Ziti Desktop Edge";