Do not exception on thread abort.

This commit is contained in:
2017-06-13 18:21:12 +01:00
parent 379d29ca02
commit bc1dadefaa
7 changed files with 107 additions and 1 deletions

View File

@@ -1,3 +1,13 @@
2017-06-13 Natalia Portillo <claunia@claunia.com>
* Workers/Clamd.cs:
* Workers/Files.cs:
* Workers/Database.cs:
* Workers/VirusTotal.cs:
* Workers/Compression.cs:
* Workers/DiscImageChef.cs:
Do not exception on thread abort.
2017-06-06 Natalia Portillo <claunia@claunia.com>
* AlgoEnum.cs:

View File

@@ -270,10 +270,15 @@ namespace osrepodbmgr.Core
return;
}
catch(System.Threading.ThreadAbortException)
{ }
catch(Exception ex)
{
if(Failed != null)
Failed(string.Format("Exception {0} when calling clamd", ex.Message));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}

View File

@@ -299,12 +299,17 @@ namespace osrepodbmgr.Core
if(FinishedWithText != null)
FinishedWithText(string.Format("Correctly added operating system with MDID {0}", mdid));
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -433,12 +438,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -471,6 +481,8 @@ namespace osrepodbmgr.Core
Context.tmpFolder = tmpFolder;
}
catch(ThreadAbortException)
{ }
catch(Exception)
{
if(Debugger.IsAttached)
@@ -507,6 +519,9 @@ namespace osrepodbmgr.Core
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
else
@@ -548,12 +563,17 @@ namespace osrepodbmgr.Core
Finished();
}
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -692,12 +712,17 @@ namespace osrepodbmgr.Core
zipCurrentEntryName = "";
zf.Save();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}

View File

@@ -29,6 +29,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
namespace osrepodbmgr.Core
{
@@ -77,12 +78,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -176,12 +182,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -261,12 +272,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -315,12 +331,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -380,12 +401,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -398,12 +424,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}

View File

@@ -123,6 +123,9 @@ namespace osrepodbmgr.Core
if(Failed != null)
Failed(string.Format("Unable to open image format\n" +
"Error: {0}", ex.Message));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
return;
}
@@ -989,6 +992,9 @@ namespace osrepodbmgr.Core
{
if(Failed != null)
Failed(string.Format("Error reading file: {0}\n{1}", ex.Message, ex.StackTrace));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}

View File

@@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml;
using System.Xml.Serialization;
using DiscImageChef.Checksums;
@@ -85,12 +86,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -491,12 +497,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -511,7 +522,9 @@ namespace osrepodbmgr.Core
Finished();
}
}
catch(System.IO.IOException)
catch(ThreadAbortException)
{ }
catch(IOException)
{
// Could not delete temporary files, do not crash.
if(Finished != null)
@@ -523,6 +536,9 @@ namespace osrepodbmgr.Core
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -585,12 +601,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
@@ -789,12 +810,17 @@ namespace osrepodbmgr.Core
if(Finished != null)
Finished();
}
catch(ThreadAbortException)
{ }
catch(Exception ex)
{
if(Debugger.IsAttached)
throw;
if(Failed != null)
Failed(string.Format("Exception {0}\n{1}", ex.Message, ex.InnerException));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}

View File

@@ -389,6 +389,9 @@ namespace osrepodbmgr.Core
{
if(Failed != null)
Failed(string.Format("Exception {0} when calling VirusTotal", ex.InnerException.Message));
#if DEBUG
Console.WriteLine("Exception {0}\n{1}", ex.Message, ex.InnerException);
#endif
}
}
}