using System; using System.Threading.Tasks; namespace Bit.Core.Utilities { public static class TaskExtensions { /// /// Fires a task and ignores any exception. /// See http://stackoverflow.com/a/22864616/344182 /// /// The task to be forgotten. /// Action to be called on exception. public static async void FireAndForget(this Task task, Action onException = null) { try { await task.ConfigureAwait(false); } catch (Exception ex) { onException?.Invoke(ex); // TODO: Add app center exception handling in here, but we have to check whether we can add the AppCenter package to Core } } } }