private static void SendError(bool randomizeDates = false, int?errorCode = null, bool critical = false, bool writeToConsole = true) { if (!errorCode.HasValue) { errorCode = _random.Next(); } try { throw new MyException(errorCode.Value, Guid.NewGuid().ToString()); } catch (Exception ex) { ErrorBuilder err = ex.ToExceptionless() .AddObject(new { myApplicationVersion = new Version(1, 0), Date = DateTime.Now, __sessionId = "9C72E4E8-20A2-469B-AFB9-492B6E349B23", SomeField10 = "testing" }, "Object From Code"); if (randomizeDates) { err.Target.OccurrenceDate = RandomHelper.GetDateTime(minimum: DateTime.Now.AddDays(-90), maximum: DateTime.Now); } if (critical) { err.MarkAsCritical(); } if (ExceptionlessClient.Current.Configuration.GetBoolean("IncludeConditionalData")) { err.AddObject(new { Total = 32.34, ItemCount = 2, Email = "*****@*****.**" }, "Conditional Data"); } err.Submit(); } if (writeToConsole) { Console.SetCursorPosition(0, 11); Console.WriteLine("Sent 1 error."); Trace.WriteLine("Sent 1 error."); } }