diff --git a/Disco.Services/Attachments/AttachmentActionExtensions.cs b/Disco.Services/Attachments/AttachmentActionExtensions.cs index c043a027..b3f6b322 100644 --- a/Disco.Services/Attachments/AttachmentActionExtensions.cs +++ b/Disco.Services/Attachments/AttachmentActionExtensions.cs @@ -3,7 +3,6 @@ using Disco.Models.Repository; using Disco.Services.Authorization; using Disco.Services.Documents.ManagedGroups; using Disco.Services.Users; -using Exceptionless; using System; using System.Drawing; using System.IO; @@ -249,10 +248,7 @@ namespace Disco.Services return true; } } - catch (Exception ex) - { - ex.ToExceptionless().Submit(); - } + catch (Exception) { } } @@ -281,10 +277,7 @@ namespace Disco.Services } } } - catch (Exception ex) - { - ex.ToExceptionless().Submit(); - } + catch (Exception) { } } } Thumbnail = null; diff --git a/Disco.Services/Devices/DeviceDetailExtensions.cs b/Disco.Services/Devices/DeviceDetailExtensions.cs index f991be72..2e71ce54 100644 --- a/Disco.Services/Devices/DeviceDetailExtensions.cs +++ b/Disco.Services/Devices/DeviceDetailExtensions.cs @@ -1,6 +1,6 @@ using Disco.Models.ClientServices.EnrolmentInformation; using Disco.Models.Repository; -using Exceptionless.Json; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; diff --git a/Disco.Services/Devices/DeviceExtensions.cs b/Disco.Services/Devices/DeviceExtensions.cs index 2f262757..c69b39fa 100644 --- a/Disco.Services/Devices/DeviceExtensions.cs +++ b/Disco.Services/Devices/DeviceExtensions.cs @@ -6,7 +6,6 @@ using Disco.Services.Documents; using Disco.Services.Expressions; using Disco.Services.Interop.ActiveDirectory; using Disco.Services.Users; -using Exceptionless; using System; using System.Collections.Generic; using System.Linq; @@ -36,7 +35,6 @@ namespace Disco.Services } catch (Exception ex) { - ex.ToExceptionless().AddObject(deviceProfile.ComputerNameTemplate, "ComputerNameTemplate").Submit(); throw new InvalidOperationException(string.Format("An error occurred rendering the computer name: [{0}] {1}", ex.GetType().Name, ex.Message), ex.InnerException); } if (rendered == null || rendered.Length > 24) diff --git a/Disco.Services/Devices/Enrolment/DeviceEnrolment.cs b/Disco.Services/Devices/Enrolment/DeviceEnrolment.cs index f293c166..2359a598 100644 --- a/Disco.Services/Devices/Enrolment/DeviceEnrolment.cs +++ b/Disco.Services/Devices/Enrolment/DeviceEnrolment.cs @@ -4,7 +4,6 @@ using Disco.Models.Repository; using Disco.Services.Authorization; using Disco.Services.Interop.ActiveDirectory; using Disco.Services.Users; -using Exceptionless; using PListNet; using PListNet.Nodes; using Renci.SshNet; @@ -148,7 +147,6 @@ namespace Disco.Services.Devices.Enrolment } catch (System.Exception ex) { - ex.ToExceptionless().Submit(); EnrolmentLog.LogSessionError(sessionId, ex); throw ex; } @@ -283,9 +281,8 @@ namespace Disco.Services.Devices.Enrolment EnrolmentLog.LogSessionError(sessionId, ex); return new MacEnrolResponse { ErrorMessage = ex.Message }; } - catch (System.Exception ex2) + catch (Exception ex2) { - ex2.ToExceptionless().Submit(); EnrolmentLog.LogSessionError(sessionId, ex2); throw ex2; } @@ -665,9 +662,8 @@ namespace Disco.Services.Devices.Enrolment ErrorMessage = ex.Message }; } - catch (System.Exception ex2) + catch (Exception ex2) { - ex2.ToExceptionless().Submit(); EnrolmentLog.LogSessionError(sessionId, ex2); throw ex2; } diff --git a/Disco.Services/Disco.Services.csproj b/Disco.Services/Disco.Services.csproj index 87caf1ea..18aff68b 100644 --- a/Disco.Services/Disco.Services.csproj +++ b/Disco.Services/Disco.Services.csproj @@ -47,12 +47,6 @@ ..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll - - ..\packages\Exceptionless.1.5.2092\lib\net45\Exceptionless.dll - - - ..\packages\Exceptionless.1.5.2092\lib\net45\Exceptionless.Models.dll - ..\packages\LumenWorks.Framework.IO.3.8.0\lib\net20\LumenWorks.Framework.IO.dll diff --git a/Disco.Services/Documents/AttachmentImport/ImporterJob.cs b/Disco.Services/Documents/AttachmentImport/ImporterJob.cs index 6f1674d8..9cf7848a 100644 --- a/Disco.Services/Documents/AttachmentImport/ImporterJob.cs +++ b/Disco.Services/Documents/AttachmentImport/ImporterJob.cs @@ -1,5 +1,4 @@ using Disco.Data.Repository; -using Exceptionless; using Quartz; using Quartz.Impl.Triggers; using System; @@ -49,8 +48,6 @@ namespace Disco.Services.Documents.AttachmentImport } catch (Exception ex) { - ex.ToExceptionless().Submit(); - // Retry 18 times (for 3 minutes) if (retryCount < 18) { diff --git a/Disco.Services/Jobs/JobActionExtensions.cs b/Disco.Services/Jobs/JobActionExtensions.cs index 4ff8934c..a19be51b 100644 --- a/Disco.Services/Jobs/JobActionExtensions.cs +++ b/Disco.Services/Jobs/JobActionExtensions.cs @@ -7,7 +7,6 @@ using Disco.Services.Plugins; using Disco.Services.Plugins.Features.RepairProvider; using Disco.Services.Plugins.Features.WarrantyProvider; using Disco.Services.Users; -using Exceptionless; using System; using System.Collections.Generic; using System.Linq; @@ -221,7 +220,7 @@ namespace Disco.Services { DiscoServicesJobs.UpdateRecipientReference(Database, j, publishJobResult.Id, publishJobResult.Secret, j.JobMetaWarranty.ExternalReference); } - catch (Exception ex) { ex.ToExceptionless().Submit(); } // Ignore Errors as this is not completely necessary + catch (Exception) { } // Ignore Errors as this is not completely necessary } } } @@ -443,7 +442,7 @@ namespace Disco.Services { DiscoServicesJobs.UpdateRecipientReference(Database, j, publishJobResult.Id, publishJobResult.Secret, j.JobMetaNonWarranty.RepairerReference); } - catch (Exception ex) { ex.ToExceptionless().Submit(); } // Ignore Errors as this is not completely necessary + catch (Exception) { } // Ignore Errors as this is not completely necessary } } } diff --git a/Disco.Services/Logging/SystemLog.cs b/Disco.Services/Logging/SystemLog.cs index a2c2ab36..ac4a31bc 100644 --- a/Disco.Services/Logging/SystemLog.cs +++ b/Disco.Services/Logging/SystemLog.cs @@ -1,5 +1,4 @@ using Disco.Services.Logging.Models; -using Exceptionless; using System; using System.Collections.Generic; using System.Text; @@ -44,8 +43,6 @@ namespace Disco.Services.Logging } public static void LogException(string Component, Exception ex) { - ex.ToExceptionless().Submit(); - // Handle Special-Case Errors if (ex is System.Data.Entity.Validation.DbEntityValidationException) { diff --git a/Disco.Services/Plugins/Features/DetailsProvider/DetailsProviderService.cs b/Disco.Services/Plugins/Features/DetailsProvider/DetailsProviderService.cs index c54e2c72..a6a31eb1 100644 --- a/Disco.Services/Plugins/Features/DetailsProvider/DetailsProviderService.cs +++ b/Disco.Services/Plugins/Features/DetailsProvider/DetailsProviderService.cs @@ -3,7 +3,7 @@ using Disco.Models.Repository; using Disco.Models.Services.Plugins.Details; using Disco.Services.Authorization; using Disco.Services.Users; -using Exceptionless.Json; +using Newtonsoft.Json; using System; using System.Drawing; using System.IO; diff --git a/Disco.Services/Plugins/PluginsLog.cs b/Disco.Services/Plugins/PluginsLog.cs index aa615ac0..a854a4c9 100644 --- a/Disco.Services/Plugins/PluginsLog.cs +++ b/Disco.Services/Plugins/PluginsLog.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Disco.Services.Logging; using Disco.Services.Logging.Models; using System.Reflection; -using Exceptionless; namespace Disco.Services.Plugins { @@ -122,8 +121,6 @@ namespace Disco.Services.Plugins public static void LogInitializeException(string PluginFilename, Exception ex) { - ex.ToExceptionless().AddObject(PluginFilename, "PluginFilename").Submit(); - if (ex.InnerException != null) { Log(EventTypeIds.InitializeExceptionWithInner, PluginFilename, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); @@ -136,8 +133,6 @@ namespace Disco.Services.Plugins public static void LogPluginException(string Component, Exception ex) { - ex.ToExceptionless().AddObject(Component, "Component").Submit(); - if (ex.InnerException != null) { Log(EventTypeIds.PluginExceptionWithInner, Component, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); diff --git a/Disco.Services/Tasks/ScheduledTasksLog.cs b/Disco.Services/Tasks/ScheduledTasksLog.cs index 1a3f7543..e78da500 100644 --- a/Disco.Services/Tasks/ScheduledTasksLog.cs +++ b/Disco.Services/Tasks/ScheduledTasksLog.cs @@ -1,8 +1,10 @@ using System; using System.Collections.Generic; +using System.Data; +using System.Data.Entity.Validation; +using System.Text; using Disco.Services.Logging; using Disco.Services.Logging.Models; -using Exceptionless; namespace Disco.Services.Tasks { @@ -55,8 +57,6 @@ namespace Disco.Services.Tasks public static void LogInitializeException(Exception ex) { - ex.ToExceptionless().Submit(); - if (ex.InnerException != null) { Log(EventTypeIds.InitializeExceptionWithInner, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); @@ -68,8 +68,6 @@ namespace Disco.Services.Tasks } public static void LogInitializeException(Exception ex, Type ScheduledTaskType) { - ex.ToExceptionless().Submit(); - if (ex.InnerException != null) { Log(EventTypeIds.InitializeScheduledTasksExceptionWithInner, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); @@ -82,19 +80,37 @@ namespace Disco.Services.Tasks public static void LogScheduledTaskException(string ScheduledTaskName, string SessionId, Type ScheduledTaskType, Exception ex) { - ex.ToExceptionless() - .AddTags("Scheduled Task") - .AddObject(ScheduledTaskName, "ScheduledTaskName") - .AddObject(ScheduledTaskType.Name, "ScheduledTaskTypeName") - .Submit(); - - if (ex.InnerException != null) + string message; + if (ex is DbEntityValidationException dbException) { - Log(EventTypeIds.ScheduledTasksExceptionWithInner, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); + StringBuilder messageBuilder = new StringBuilder(); + messageBuilder.AppendLine("Validation failed for one or more entities:"); + foreach (var dbEntityError in dbException.EntityValidationErrors) + { + messageBuilder.Append("'").Append(dbEntityError.Entry.Entity.GetType().Name).AppendLine("' Object"); + foreach (var dbValidationError in dbEntityError.ValidationErrors) + { + messageBuilder.Append(" ").Append(dbValidationError.PropertyName).Append(": ").AppendLine(dbValidationError.ErrorMessage); + } + } + message = messageBuilder.ToString(); } else { - Log(EventTypeIds.ScheduledTasksException, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace); + message = ex.Message; + } + + if (ex.InnerException != null) + { + var innerException = ex.InnerException; + if (innerException is UpdateException updateException) + innerException = updateException.InnerException; + + Log(EventTypeIds.ScheduledTasksExceptionWithInner, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, message, ex.StackTrace, innerException.GetType().Name, innerException.Message, innerException.StackTrace); + } + else + { + Log(EventTypeIds.ScheduledTasksException, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, message, ex.StackTrace); } } diff --git a/Disco.Services/packages.config b/Disco.Services/packages.config index 4cf5d546..41bbe610 100644 --- a/Disco.Services/packages.config +++ b/Disco.Services/packages.config @@ -3,7 +3,6 @@ - diff --git a/Disco.Web/App_Start/AppConfig.cs b/Disco.Web/App_Start/AppConfig.cs index fa0104ce..efc4c506 100644 --- a/Disco.Web/App_Start/AppConfig.cs +++ b/Disco.Web/App_Start/AppConfig.cs @@ -1,13 +1,9 @@ using Disco.Data.Repository; using Disco.Services; using Disco.Services.Interop.DiscoServices; -using Exceptionless; -using Exceptionless.Configuration; using System; using System.Linq; -[assembly: Exceptionless("https://errors.discoict.com.au", "c81e644582374f68aaf1fb546e3db0cd")] - namespace Disco.Web { public static class AppConfig @@ -31,8 +27,6 @@ namespace Disco.Web public static void InitalizeCoreEnvironment(DiscoDataContext Database) { - ExceptionlessClient.Current.SendingError += Exceptionless_SendingError; - // Initialize Logging Disco.Services.Logging.LogContext.Initalize(Database, DiscoApplication.SchedulerFactory); @@ -54,14 +48,6 @@ namespace Disco.Web Disco.Services.Users.UserService.Initialize(Database); } - static void Exceptionless_SendingError(object sender, ErrorModelEventArgs e) - { - e.Error.UserName = DiscoApplication.DeploymentId; - e.Error.UserDescription = DiscoApplication.OrganisationName; - - e.Error.Tags.Add(string.Concat("v", DiscoApplication.Version)); - } - public static void InitalizeNormalEnvironment(DiscoDataContext Database) { InitalizeCoreEnvironment(Database); diff --git a/Disco.Web/Controllers/JobController.cs b/Disco.Web/Controllers/JobController.cs index 89b73b90..ecef8c83 100644 --- a/Disco.Web/Controllers/JobController.cs +++ b/Disco.Web/Controllers/JobController.cs @@ -15,7 +15,6 @@ using Disco.Services.Plugins.Features.UIExtension; using Disco.Services.Plugins.Features.WarrantyProvider; using Disco.Services.Users; using Disco.Services.Web; -using Exceptionless; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -592,7 +591,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); m.Error = ex; return View(Views.LogWarrantyError, m); throw; @@ -607,7 +605,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); m.Error = ex; return View(Views.LogWarrantyError, m); } @@ -630,7 +627,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); m.Error = ex; return View(Views.LogWarrantyError, m); throw; @@ -675,7 +671,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); model.JobDetailsSupported = false; model.JobDetailsException = ex; return View(model); @@ -778,7 +773,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); m.Error = ex; return View(Views.LogRepairError, m); throw; @@ -793,7 +787,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); m.Error = ex; return View(Views.LogRepairError, m); } @@ -816,7 +809,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); m.Error = ex; return View(Views.LogRepairError, m); throw; @@ -861,7 +853,6 @@ namespace Disco.Web.Controllers } catch (Exception ex) { - ex.ToExceptionless().Submit(); model.JobDetailsSupported = false; model.JobDetailsException = ex; return View(model); diff --git a/Disco.Web/Disco.Web.csproj b/Disco.Web/Disco.Web.csproj index 06db1bc4..309acc26 100644 --- a/Disco.Web/Disco.Web.csproj +++ b/Disco.Web/Disco.Web.csproj @@ -24,6 +24,8 @@ true + + true @@ -45,15 +47,6 @@ true - - ..\packages\Exceptionless.1.5.2092\lib\net45\Exceptionless.dll - - - ..\packages\Exceptionless.1.5.2092\lib\net45\Exceptionless.Models.dll - - - ..\packages\Exceptionless.Mvc.1.5.2092\lib\net45\Exceptionless.Mvc.dll - ..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll diff --git a/Disco.Web/Web.config b/Disco.Web/Web.config index 43886422..4e8131c3 100644 --- a/Disco.Web/Web.config +++ b/Disco.Web/Web.config @@ -39,7 +39,6 @@ - diff --git a/Disco.Web/packages.config b/Disco.Web/packages.config index 03644bf8..2ee03031 100644 --- a/Disco.Web/packages.config +++ b/Disco.Web/packages.config @@ -4,8 +4,6 @@ - -