Skip to content

refactor: uniform ConfigureAwait(false) on service-layer Task.Run calls#968

Merged
laurentiu021 merged 3 commits into
mainfrom
refactor/configureawait-uniformity
Jun 22, 2026
Merged

refactor: uniform ConfigureAwait(false) on service-layer Task.Run calls#968
laurentiu021 merged 3 commits into
mainfrom
refactor/configureawait-uniformity

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Summary

Async uniformity from the modernization audit. Library/service code should not capture the synchronization context; most services already use ConfigureAwait(false) on their Task.Run calls, these three were the outliers. refactor:, behavior-preserving, no release.

Changes

  • SystemReportService (line 36): Task.Run(...) -> .ConfigureAwait(false) — the rest of the same method already used it.
  • TemperatureService (lines 38, 45 + the two awaits after them): added ConfigureAwait(false). Service mutates a local list and returns it; no UI access on the continuation.
  • MemoryTestService (both CheckErrorLogsAsync and GetModulesAsync): added ConfigureAwait(false) to the Task.Run blocks.

Why uniform, not blanket

Matches the existing convention (EventLogService, PowerShellRunner, ServiceManagerService, SpeedTestService all use ConfigureAwait(false) on Task.Run). ViewModel continuations that touch the UI keep ConfigureAwait(true) — those were left alone.

Verification

  • dotnet build (app + tests): 0 warnings, 0 errors (TreatWarningsAsErrors=true).

@laurentiu021 laurentiu021 merged commit 722c65a into main Jun 22, 2026
4 checks passed
@laurentiu021 laurentiu021 deleted the refactor/configureawait-uniformity branch June 22, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant