Improved the stability of the crash reporting system.

This commit is contained in:
Michael Möller
2010-04-25 19:05:15 +00:00
parent 426938de54
commit 98c7c31cac
3 changed files with 16 additions and 9 deletions

View File

@@ -79,7 +79,7 @@ namespace OpenHardwareMonitor.GUI {
WebRequest request = WebRequest.Create( WebRequest request = WebRequest.Create(
"http://openhardwaremonitor.org/report.php"); "http://openhardwaremonitor.org/report.php");
request.Method = "POST"; request.Method = "POST";
request.Timeout = 3000; request.Timeout = 5000;
request.ContentType = "application/x-www-form-urlencoded"; request.ContentType = "application/x-www-form-urlencoded";
string report = string report =
@@ -89,10 +89,11 @@ namespace OpenHardwareMonitor.GUI {
byte[] byteArray = Encoding.UTF8.GetBytes(report); byte[] byteArray = Encoding.UTF8.GetBytes(report);
request.ContentLength = byteArray.Length; request.ContentLength = byteArray.Length;
try {
Stream dataStream = request.GetRequestStream(); Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length); dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close(); dataStream.Close();
try {
WebResponse response = request.GetResponse(); WebResponse response = request.GetResponse();
dataStream = response.GetResponseStream(); dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream); StreamReader reader = new StreamReader(dataStream);
@@ -100,10 +101,13 @@ namespace OpenHardwareMonitor.GUI {
reader.Close(); reader.Close();
dataStream.Close(); dataStream.Close();
response.Close(); response.Close();
} catch (WebException) {
}
} finally {
Close(); Close();
} catch (WebException) {
MessageBox.Show("Sending the crash report failed.", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
}
} catch {
} }
} }
} }

View File

@@ -91,7 +91,10 @@ namespace OpenHardwareMonitor {
Exception e = args.ExceptionObject as Exception; Exception e = args.ExceptionObject as Exception;
if (e != null) if (e != null)
ReportException(e); ReportException(e);
} catch { } } catch {
} finally {
Environment.Exit(0);
}
} }
} }
} }

View File

@@ -69,5 +69,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.30.0")] [assembly: AssemblyVersion("0.1.31.0")]
[assembly: AssemblyFileVersion("0.1.30.0")] [assembly: AssemblyFileVersion("0.1.31.0")]