JetBrains Rider 2026.1 Help

Code inspection: Replace 'async' code with 'Task'-return

This inspection reports an async method or local function that only awaits task-returning expressions in tail positions. In this case, async/await adds state-machine overhead without changing behavior, so the code can return the task directly.

Example

using System.Threading.Tasks; class C { public async Task<int> GetValue() { return await Task.FromResult(42); } }
using System.Threading.Tasks; class C { public Task<int> GetValue() { return Task.FromResult(42); } }

Quick-fix

Remove async and return the task directly. The fix also unwraps ConfigureAwait(false) and updates return; in Task-returning methods to return Task.CompletedTask when needed.

29 March 2026