Skip to content

refactor: final modernization stragglers (seal, ConfigureAwait, ToArray)#969

Merged
laurentiu021 merged 1 commit into
mainfrom
refactor/modernization-stragglers
Jun 22, 2026
Merged

refactor: final modernization stragglers (seal, ConfigureAwait, ToArray)#969
laurentiu021 merged 1 commit into
mainfrom
refactor/modernization-stragglers

Conversation

@laurentiu021

Copy link
Copy Markdown
Owner

Summary

Closes out the last verified modernization stragglers from the completeness audit. refactor:, behavior-preserving, no release.

Changes

  • seal BulkObservableCollection — no subclasses exist; sealing matches the rest of the codebase and allows JIT devirtualization.
  • ConfigureAwait(false) on the three service awaits that actually await (SpeedTestService Task.WhenAll, PingMonitorService + TracerouteMonitorService background Task.Delay). These continuations do not touch the UI (monitors emit via events).
  • .ToList() -> .ToArray() on three methods whose return type is IReadOnlyList (ActivityLogService.GetRecent, LargeFileScanner.Scan, DnsService.CaptureCurrentServersAsync) — array satisfies the interface without keeping a List's spare capacity.

Audit false-positives deliberately NOT applied (verified against real code)

  • ConfigureAwait on the expression-bodied => Task.Run(...) services: they RETURN the task without awaiting; all 13 such services use this exact uniform pattern, so adding it would force them async for zero benefit.
  • new List(2) -> []: the capacity hint is intentional; left as-is.
  • ServiceManagerService CancellationToken: WaitForStatus already has a 30s timeout and no caller has a token to pass.

Verification

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

…rvice tasks, ToArray for IReadOnlyList returns
@laurentiu021 laurentiu021 merged commit 5f39fb8 into main Jun 22, 2026
4 checks passed
@laurentiu021 laurentiu021 deleted the refactor/modernization-stragglers branch June 22, 2026 12:33
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