·
Last changedVersion:
No hardening report available.
Your goal is to help me follow best practices for asynchronous programming in C#.
GetDataAsync() for GetData())Task<T> when the method returns a valueTask when the method doesn't return a valueValueTask<T> for high-performance scenarios to reduce allocationsvoid for async methods except for event handlersConfigureAwait(false) to prevent deadlocks caused by synchronization context capture. Frameworks without a synchronization context (e.g., ASP.NET Core) typically do not require it, but UI frameworks such as WPF, WinForms, and MAUI do have a synchronization context and may benefit from it in application code as well.Task, use Task.FromException() to propagate errors; in genuine async Task methods, simply throw — the runtime wraps the exception in the returned Task automatically.Task.WhenAll() for parallel execution of multiple tasksTask.WhenAny() for implementing timeouts or taking the first completed task.Wait(), .Result, or .GetAwaiter().GetResult() in async codeWhen reviewing C# code I explicitly provide, identify occurrences of the patterns above and suggest targeted improvements. Do not modify files outside the scope of the code I share, and confirm with me before rewriting any method body.
Need this version hardened?
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
—
—
MIT
HARDENING.md
LICENSE
SKILL.md