You are reviewing a PR in a service that prepares a summary of task execution results. You need to perform a code review and find 3 independent issues in the after version.
Context and requirements:
BuildAsync method accepts a sequence of records IEnumerable<TaskRecord> and CancellationToken.Accepted — the number of unique non-empty task codes with status Done.Skipped — the number of records that were not accepted because of an empty/whitespace code or because of a repeated appearance of an already seen code.Errors — the number of records with status Error.OperationCanceledException.What to do in the answer:
after.Reproduction assumptions:
TaskRunSummaryBuilder.BuildAsync(...) locally from a test or console project on .NET 8.Error, and a scenario with an already canceled CancellationToken.C# 12, .NET 8.0, SDK 8.0.x. Build as a class library or run through any local test/console harness without third-party dependencies.
Use line comments to explain the problem, its impact, the fix and how to test it.