/// <summary> /// Execute an <paramref name="asyncMethod"/> in the background. /// </summary> /// <param name="asyncMethod">The action to run in the background.</param> /// <returns>The created thread.</returns> public static Thread FireAndForgetWithExpensiveStackTracePreservation(Func <Task> asyncMethod) { FulcrumApplication.ValidateButNotInProduction(); var context = new StackTracePreservation(); return(FireAndForget(() => context.ExecuteActionFailSafeAsync(asyncMethod))); }
/// <summary> /// Execute an <paramref name="asyncMethod"/> in the background. /// </summary> /// <param name="asyncMethod">The action to run in the background.</param> /// <param name="token">Propagates notification that operations should be canceled</param> /// <returns>The created thread.</returns> public static Thread FireAndForgetWithExpensiveStackTracePreservation(Func <CancellationToken, Task> asyncMethod, CancellationToken token = default) { FulcrumApplication.ValidateButNotInProduction(); var context = new StackTracePreservation(); return(FireAndForget(ct => context.ExecuteActionFailSafeAsync(asyncMethod, ct), token)); }
/// <summary> /// Execute an <paramref name="action"/> in the background. /// </summary> /// <param name="action">The action to run in the background.</param> /// <returns>The created thread.</returns> public static Thread FireAndForgetWithExpensiveStackTracePreservation(Action action) { FulcrumApplication.ValidateButNotInProduction(); var context = new StackTracePreservation(); return(FireAndForget(() => context.ExecuteActionFailSafe(action))); }