/// <summary> /// Gets a list of application versions /// </summary> /// <remarks> /// Gets a list of application versions /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <AppVersion> > GetAppVersionsAsync(this ICrashes operations, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetAppVersionsWithHttpMessagesAsync(ownerName, appName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets all attachments for a specific crash /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <CrashAttachment> > ListAttachmentsAsync(this ICrashes operations, string crashId, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListAttachmentsWithHttpMessagesAsync(crashId, ownerName, appName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets a specific crash for an app /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='includeReport'> /// true if the crash should include the raw crash report. Default is false /// </param> /// <param name='includeLog'> /// true if the crash should include the custom log report. Default is false /// </param> /// <param name='includeDetails'> /// true if the crash should include in depth crash details /// </param> /// <param name='includeStacktrace'> /// true if the crash should include the stacktrace information /// </param> /// <param name='groupingOnly'> /// true if the stacktrace should be only the relevant thread / exception. /// Default is false /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Crash> GetAsync(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, bool?includeReport = false, bool?includeLog = false, bool?includeDetails = false, bool?includeStacktrace = false, bool?groupingOnly = false, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(crashGroupId, crashId, ownerName, appName, includeReport, includeLog, includeDetails, includeStacktrace, groupingOnly, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets the native log of a specific crash /// </summary> /// <remarks> /// Gets the native log of a specific crash /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <string> GetNativeCrashAsync(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetNativeCrashWithHttpMessagesAsync(crashGroupId, crashId, ownerName, appName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Delete a specific crash and related attachments and blobs for an app /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='retentionDelete'> /// true in that case if the method should skip update counts /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <CrashDeleteCounter> DeleteAsync(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, bool?retentionDelete = false, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.DeleteWithHttpMessagesAsync(crashGroupId, crashId, ownerName, appName, retentionDelete, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Get session logs by crash ID /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashId'> /// The id of the a crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='date'> /// Date of data requested /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <GenericLogContainer> ListSessionLogsAsync(this ICrashes operations, string crashId, string ownerName, string appName, System.DateTime?date = default(System.DateTime?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListSessionLogsWithHttpMessagesAsync(crashId, ownerName, appName, date, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets a stacktrace for a specific crash /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='groupingOnly'> /// true if the stacktrace should be only the relevant thread / exception. /// Default is false /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <Stacktrace> GetStacktraceAsync(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, bool?groupingOnly = false, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetStacktraceWithHttpMessagesAsync(crashGroupId, crashId, ownerName, appName, groupingOnly, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets all crashes of a group /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='includeReport'> /// true if the crash should include the raw crash report. Default is false /// </param> /// <param name='includeLog'> /// true if the crash should include the custom log report. Default is false /// </param> /// <param name='dateFrom'> /// </param> /// <param name='dateTo'> /// </param> /// <param name='appVersion'> /// version /// </param> /// <param name='errorType'> /// Possible values include: 'CrashingErrors', 'HandledErrors' /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <IList <Crash> > ListAsync(this ICrashes operations, string crashGroupId, string ownerName, string appName, bool?includeReport = false, bool?includeLog = false, System.DateTime?dateFrom = default(System.DateTime?), System.DateTime?dateTo = default(System.DateTime?), string appVersion = default(string), string errorType = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ListWithHttpMessagesAsync(crashGroupId, ownerName, appName, includeReport, includeLog, dateFrom, dateTo, appVersion, errorType, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Creates and updates the retention settings in days /// </summary> /// <remarks> /// Creates and updates the retention settings in days /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='retentionInDays'> /// The amount of days to keep the crashes for this application. /// retention_in_days is an enum value, can only be 28 or 90. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <RetentionSettings> UpsertRetentionSettingsAsync(this ICrashes operations, RetentionSettings retentionInDays, string ownerName, string appName, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpsertRetentionSettingsWithHttpMessagesAsync(retentionInDays, ownerName, appName, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public void Invokes_TrackError( Exception exception, IDictionary <string, string> properties, ICrashes sut) { exception.Report(properties, sut); Mock.Get(sut).Verify(c => c.TrackError(exception, properties)); }
public async Task WhenErrorReportAsync_Invokes_Crashes_TrackError( Exception exception, ICrashes crashes) { await Task.Run(() => throw exception).WhenErrorReportAsync(crashes); Mock.Get(crashes).Verify(c => c.TrackError(exception, null)); }
public void Invokes_Exception_Thrown_By_TrackError( Exception exception, Exception thrown, IDictionary <string, string> properties, ICrashes sut) { var mock = Mock.Get(sut); mock.Setup(c => c.TrackError(exception, properties)) .Throws(thrown); exception.Report(properties, sut); mock.Verify(c => c.TrackError(thrown, null)); }
#pragma warning restore AvoidAsyncVoid // Avoid async void /// <summary> /// Wraps the async operation in a try/catch and reports possible exceptions to AppCenter /// </summary> /// <param name="inputTask">Task to await and wrap with a try/catch</param> /// <param name="crashes"> /// Keep this as NULL to use the default implementation. /// This is only exposed for unit testing purposes /// </param> /// <returns>Returns a Task as the result of ConfigureAwait(false)</returns> public static async Task WhenErrorReportAsync( this Task inputTask, ICrashes crashes = null) { try { await inputTask.ConfigureAwait(false); } catch (Exception ex) { ex.Report(crashes: crashes); } }
public void Forget_Invokes_Crashes_TrackError( Exception exception, ICrashes crashes) { var task = Task.Run(() => throw exception); task.Forget(true, crashes); new Func <Task>(() => task) .Should() .Throw <Exception>(); Mock.Get(crashes).Verify(c => c.TrackError(exception, null)); }
/// <summary> /// Wraps the async operation in a try/catch and reports possible exceptions to AppCenter /// </summary> /// <typeparam name="T">Type of the result</typeparam> /// <param name="inputTask">Task to await and wrap with a try/catch</param> /// <param name="crashes"> /// Keep this as NULL to use the default implementation. /// This is only exposed for unit testing purposes /// </param> /// <returns>Returns a Task as the result of ConfigureAwait(false)</returns> public static async Task <T> WhenErrorReportAsync <T>( this Task <T> inputTask, ICrashes crashes = null) where T : class { try { return(await inputTask.ConfigureAwait(false)); } catch (Exception ex) { ex.Report(crashes: crashes); return(null); } }
#pragma warning disable AvoidAsyncVoid // Avoid async void /// <summary> /// Performs a fire-and-forget operation on a given Task /// </summary> /// <param name="task">Task to await and wrap with a try/catch</param> /// <param name="report"> /// Keep this to TRUE to report any possibly thrown Exceptions to AppCenter /// </param> /// <param name="crashes"> /// Keep this as NULL to use the default implementation. /// This is only exposed for unit testing purposes /// </param> public static async void Forget( this Task task, bool report = true, ICrashes crashes = null) { try { await task.ConfigureAwait(false); } catch (Exception ex) { if (report) { ex.Report(crashes: crashes); } } }
/// <summary> /// Send error to AppCenter /// </summary> /// <param name="exception">The error</param> /// <param name="properties">Custom properties to include in the error report</param> /// <param name="crashes">Keep this as NULL to use the default implementation. This is only exposed for unit testing purposes</param> public static void Report( this Exception exception, IDictionary <string, string> properties = null, ICrashes crashes = null) { if (crashes == null) { crashes = AppCenterCrashes.Instance; } try { crashes.TrackError(exception, properties); } catch (Exception e) { Debug.WriteLine(e.ToString()); crashes.TrackError(e); } }
/// <summary> /// Gets whether the application has any crashes /// </summary> /// <remarks> /// Gets whether the application has any crashes /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static AppCrashesInfo GetAppCrashesInfo(this ICrashes operations, string ownerName, string appName) { return(operations.GetAppCrashesInfoAsync(ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Gets a stacktrace for a specific crash /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='groupingOnly'> /// true if the stacktrace should be only the relevant thread / exception. /// Default is false /// </param> public static Stacktrace GetStacktrace(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, bool?groupingOnly = false) { return(operations.GetStacktraceAsync(crashGroupId, crashId, ownerName, appName, groupingOnly).GetAwaiter().GetResult()); }
/// <summary> /// Gets all crashes of a group /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='includeReport'> /// true if the crash should include the raw crash report. Default is false /// </param> /// <param name='includeLog'> /// true if the crash should include the custom log report. Default is false /// </param> /// <param name='dateFrom'> /// </param> /// <param name='dateTo'> /// </param> /// <param name='appVersion'> /// version /// </param> /// <param name='errorType'> /// Possible values include: 'CrashingErrors', 'HandledErrors' /// </param> public static IList <Crash> List(this ICrashes operations, string crashGroupId, string ownerName, string appName, bool?includeReport = false, bool?includeLog = false, System.DateTime?dateFrom = default(System.DateTime?), System.DateTime?dateTo = default(System.DateTime?), string appVersion = default(string), string errorType = default(string)) { return(operations.ListAsync(crashGroupId, ownerName, appName, includeReport, includeLog, dateFrom, dateTo, appVersion, errorType).GetAwaiter().GetResult()); }
/// <summary> /// Get session logs by crash ID /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashId'> /// The id of the a crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='date'> /// Date of data requested /// </param> public static GenericLogContainer ListSessionLogs(this ICrashes operations, string crashId, string ownerName, string appName, System.DateTime?date = default(System.DateTime?)) { return(operations.ListSessionLogsAsync(crashId, ownerName, appName, date).GetAwaiter().GetResult()); }
/// <summary> /// Delete a specific crash and related attachments and blobs for an app /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='retentionDelete'> /// true in that case if the method should skip update counts /// </param> public static CrashDeleteCounter Delete(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, bool?retentionDelete = false) { return(operations.DeleteAsync(crashGroupId, crashId, ownerName, appName, retentionDelete).GetAwaiter().GetResult()); }
/// <summary> /// Gets a list of application versions /// </summary> /// <remarks> /// Gets a list of application versions /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static IList <AppVersion> GetAppVersions(this ICrashes operations, string ownerName, string appName) { return(operations.GetAppVersionsAsync(ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Gets content of the text attachment /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static string GetCrashTextAttachmentContent(this ICrashes operations, string crashId, string attachmentId, string ownerName, string appName) { return(operations.GetCrashTextAttachmentContentAsync(crashId, attachmentId, ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Creates and updates the retention settings in days /// </summary> /// <remarks> /// Creates and updates the retention settings in days /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='retentionInDays'> /// The amount of days to keep the crashes for this application. /// retention_in_days is an enum value, can only be 28 or 90. /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static RetentionSettings UpsertRetentionSettings(this ICrashes operations, RetentionSettings retentionInDays, string ownerName, string appName) { return(operations.UpsertRetentionSettingsAsync(retentionInDays, ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Gets a specific crash for an app /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> /// <param name='includeReport'> /// true if the crash should include the raw crash report. Default is false /// </param> /// <param name='includeLog'> /// true if the crash should include the custom log report. Default is false /// </param> /// <param name='includeDetails'> /// true if the crash should include in depth crash details /// </param> /// <param name='includeStacktrace'> /// true if the crash should include the stacktrace information /// </param> /// <param name='groupingOnly'> /// true if the stacktrace should be only the relevant thread / exception. /// Default is false /// </param> public static Crash Get(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName, bool?includeReport = false, bool?includeLog = false, bool?includeDetails = false, bool?includeStacktrace = false, bool?groupingOnly = false) { return(operations.GetAsync(crashGroupId, crashId, ownerName, appName, includeReport, includeLog, includeDetails, includeStacktrace, groupingOnly).GetAwaiter().GetResult()); }
/// <summary> /// Gets the URI location to download crash attachment /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='attachmentId'> /// attachment id /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static CrashAttachmentLocation GetCrashAttachmentLocation(this ICrashes operations, string crashId, string attachmentId, string ownerName, string appName) { return(operations.GetCrashAttachmentLocationAsync(crashId, attachmentId, ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Gets the native log of a specific crash /// </summary> /// <remarks> /// Gets the native log of a specific crash /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static string GetNativeCrash(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName) { return(operations.GetNativeCrashAsync(crashGroupId, crashId, ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Gets the URI location to download json of a specific crash /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashGroupId'> /// id of a specific group /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static CrashRawLocation GetRawCrashLocation(this ICrashes operations, string crashGroupId, string crashId, string ownerName, string appName) { return(operations.GetRawCrashLocationAsync(crashGroupId, crashId, ownerName, appName).GetAwaiter().GetResult()); }
/// <summary> /// Gets all attachments for a specific crash /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='crashId'> /// id of a specific crash /// </param> /// <param name='ownerName'> /// The name of the owner /// </param> /// <param name='appName'> /// The name of the application /// </param> public static IList <CrashAttachment> ListAttachments(this ICrashes operations, string crashId, string ownerName, string appName) { return(operations.ListAttachmentsAsync(crashId, ownerName, appName).GetAwaiter().GetResult()); }