diff --git a/src/10-Core/Wtq/Utils/SystemExtensions.cs b/src/10-Core/Wtq/Utils/SystemExtensions.cs new file mode 100644 index 00000000..a98cf9c0 --- /dev/null +++ b/src/10-Core/Wtq/Utils/SystemExtensions.cs @@ -0,0 +1,22 @@ +using System.Runtime.CompilerServices; + +namespace Wtq.Utils; + +public static class SystemExtensions +{ + [SuppressMessage("Usage", "VSTHRD003:Avoid awaiting foreign Tasks", Justification = "MvdO: Whether or not to await is up to the caller.")] + public static ConfiguredTaskAwaitable NoCtx(this Task task) + { + ArgumentNullException.ThrowIfNull(task); + + return task.ConfigureAwait(false); + } + + [SuppressMessage("Usage", "VSTHRD003:Avoid awaiting foreign Tasks", Justification = "MvdO: Whether or not to await is up to the caller.")] + public static ConfiguredTaskAwaitable NoCtx(this Task task) + { + ArgumentNullException.ThrowIfNull(task); + + return task.ConfigureAwait(false); + } +} \ No newline at end of file