From c14c5ab1c5d4a8d99ac19d96315b3fb12581be73 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald Date: Thu, 21 Jan 2010 23:09:45 +0000 Subject: [PATCH] UsageDataCollector: include the error code in exception reports for ExternalExceptions (COMException etc.) Removed debugging statement that saved usage data into temporary file during upload. git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5424 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../UsageDataCollector/UsageDataSessionWriter.cs | 15 +++++++++++++-- .../UsageDataCollector/UsageDataUploader.cs | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataSessionWriter.cs b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataSessionWriter.cs index 9a5b767e75..4e12446edd 100644 --- a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataSessionWriter.cs +++ b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataSessionWriter.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Generic; using System.Data.SQLite; using System.Globalization; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Text; using System.Threading; @@ -286,7 +287,7 @@ namespace ICSharpCode.UsageDataCollector { if (exception == null) throw new ArgumentNullException("exception"); - string exceptionType = exception.GetType().FullName; + string exceptionType = GetTypeName(exception); string stacktrace = exception.StackTrace; while (exception.InnerException != null) { exception = exception.InnerException; @@ -294,11 +295,21 @@ namespace ICSharpCode.UsageDataCollector stacktrace = exception.StackTrace + Environment.NewLine + "-- continuing with outer exception (" + exceptionType + ") --" + Environment.NewLine + stacktrace; - exceptionType = exception.GetType().FullName; + exceptionType = GetTypeName(exception); } AddException(exceptionType, stacktrace); } + static string GetTypeName(Exception exception) + { + string type = exception.GetType().FullName; + ExternalException ee = exception as ExternalException; + if (ee != null) + return type + " (ErrorCode " + ee.ErrorCode.ToString("x8") + ")"; + else + return type; + } + /// /// Adds an exception report to the session. /// diff --git a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs index 3280b09c91..a7d8625191 100644 --- a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs +++ b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs @@ -115,7 +115,6 @@ namespace ICSharpCode.UsageDataCollector } data = ms.ToArray(); } - File.WriteAllBytes(Path.Combine(Path.GetTempPath(), "SharpDevelopUsageData.xml.gz"), data); UDCUploadServiceClient client = new UDCUploadServiceClient(binding, endpoint); try {