In .NET 8 / C# 12, you need to improve a service that accepts a stream of tasks, processes them sequentially, and returns a short summary. Requirements: 1) the input set must be processed once and must not depend on subsequent changes to the source collection; 2) elements with an empty or whitespace-only code are considered skipped; 3) duplicate codes within a single run are considered skipped; 4) for each unique non-empty code, the service starts an asynchronous operation with CancellationToken support and reports how many tasks completed successfully, how many were skipped, and how many ended with an error; 5) when canceled, execution must stop without unnecessary waiting. Build and run: dotnet test / dotnet run in the standard .NET 8 mode, without additional packages.
C# 12, .NET 8. No additional configuration is required. The project builds and runs as a regular console application/library under net8.0.
Use line comments to explain the problem, its impact, the fix and how to test it.