Improved the stability of the crash reporting system.
authormoel.mich
Sun, 25 Apr 2010 19:05:15 +0000
changeset 984775bffe6173
parent 97 1a2d7dad320e
child 99 6d8377af9fb1
Improved the stability of the crash reporting system.
GUI/CrashReportForm.cs
Program.cs
Properties/AssemblyInfo.cs
     1.1 --- a/GUI/CrashReportForm.cs	Sun Apr 25 14:40:19 2010 +0000
     1.2 +++ b/GUI/CrashReportForm.cs	Sun Apr 25 19:05:15 2010 +0000
     1.3 @@ -79,7 +79,7 @@
     1.4          WebRequest request = WebRequest.Create(
     1.5            "http://openhardwaremonitor.org/report.php");
     1.6          request.Method = "POST";
     1.7 -        request.Timeout = 3000;
     1.8 +        request.Timeout = 5000;
     1.9          request.ContentType = "application/x-www-form-urlencoded";
    1.10  
    1.11          string report =
    1.12 @@ -89,10 +89,11 @@
    1.13          byte[] byteArray = Encoding.UTF8.GetBytes(report);
    1.14          request.ContentLength = byteArray.Length;
    1.15  
    1.16 -        Stream dataStream = request.GetRequestStream();
    1.17 -        dataStream.Write(byteArray, 0, byteArray.Length);
    1.18 -        dataStream.Close();
    1.19          try {
    1.20 +          Stream dataStream = request.GetRequestStream();
    1.21 +          dataStream.Write(byteArray, 0, byteArray.Length);
    1.22 +          dataStream.Close();
    1.23 +
    1.24            WebResponse response = request.GetResponse();
    1.25            dataStream = response.GetResponseStream();
    1.26            StreamReader reader = new StreamReader(dataStream);
    1.27 @@ -100,10 +101,13 @@
    1.28            reader.Close();
    1.29            dataStream.Close();
    1.30            response.Close();
    1.31 +
    1.32 +          Close();
    1.33          } catch (WebException) {
    1.34 +          MessageBox.Show("Sending the crash report failed.", "Error", 
    1.35 +            MessageBoxButtons.OK, MessageBoxIcon.Error);
    1.36          }
    1.37 -      } finally {
    1.38 -        Close();
    1.39 +      } catch {
    1.40        }
    1.41      }
    1.42    }  
     2.1 --- a/Program.cs	Sun Apr 25 14:40:19 2010 +0000
     2.2 +++ b/Program.cs	Sun Apr 25 19:05:15 2010 +0000
     2.3 @@ -91,7 +91,10 @@
     2.4          Exception e = args.ExceptionObject as Exception;
     2.5          if (e != null)
     2.6            ReportException(e);
     2.7 -      } catch { } 
     2.8 +      } catch {
     2.9 +      } finally {
    2.10 +        Environment.Exit(0);
    2.11 +      }
    2.12      }   
    2.13    }
    2.14  }
     3.1 --- a/Properties/AssemblyInfo.cs	Sun Apr 25 14:40:19 2010 +0000
     3.2 +++ b/Properties/AssemblyInfo.cs	Sun Apr 25 19:05:15 2010 +0000
     3.3 @@ -69,5 +69,5 @@
     3.4  // You can specify all the values or you can default the Build and Revision Numbers 
     3.5  // by using the '*' as shown below:
     3.6  // [assembly: AssemblyVersion("1.0.*")]
     3.7 -[assembly: AssemblyVersion("0.1.30.0")]
     3.8 -[assembly: AssemblyFileVersion("0.1.30.0")]
     3.9 +[assembly: AssemblyVersion("0.1.31.0")]
    3.10 +[assembly: AssemblyFileVersion("0.1.31.0")]