What problem does it solve?
Helps developers follow best practices for asynchronous programming in C#, reducing common pitfalls and performance issues.
Core Features & Use Cases
- Naming conventions: suffix Async for async methods and consistent alignment with sync counterparts (e.g., GetDataAsync() vs GetData()).
- Return types: use Task, Task<T>, or ValueTask<T> appropriately; avoid void returns except for event handlers.
- Exception handling: proper try/catch around awaits, avoid swallowing exceptions, and consider ConfigureAwait(false) in library code.
- Performance: prefer Task.WhenAll/Task.WhenAny for parallelism and timeouts; minimize allocations and unnecessary awaits.
- Common pitfalls & patterns: avoid async void (except event handlers), avoid mixing sync/blocking calls, consider IAsyncEnumerable for async sequences.
- Implementation patterns: apply TAP, async streams, and async command patterns for long-running operations.
Quick Start
Provide a sample GetDataAsync implementation that demonstrates proper naming conventions, return types, and exception handling for asynchronous methods in C#.