Skip to content

SyncHelper Class ​

Definition ​

Provides utilities for safely bridging asynchronous and synchronous code, including fire-and-forget helpers and guarded blocking execution.

  • Namespace: JASE
  • Assembly: JASE.Concurrency.dll

Properties ​

NameDescription
AllowUnsafeBlockingOptional override to forcibly allow blocking execution even in restricted environments.

Methods ​

NameDescription
void FireAndForget(Func<Task> func, Action<Exception> onError = null)Executes an async method fire-and-forget.
void FireAndForget(Task task, Action<Exception> onError = null)Executes a task without awaiting it and swallows or logs exceptions safely.
T Run(Func<Task<T>> func, bool allowUnsafeBlocking = null)Runs an asynchronous function synchronously and returns its result, enforcing environment checks to avoid deadlocks.
T Run(Func<ValueTask<T>> func, bool allowUnsafeBlocking = null)Runs an async method that returns a ValueTask1` in a blocking manner, subject to the same safety checks as the Task-based overloads.
void Run(Func<Task> func, bool allowUnsafeBlocking = null)Runs an asynchronous function synchronously, enforcing environment checks to avoid deadlocks.
void Run(Func<ValueTask> func, bool allowUnsafeBlocking = null)Runs an async method that returns a ValueTask in a blocking manner, subject to the same safety checks as the Task-based overloads.