Skip to content

[Bug] Task.WhenEach not polyfilled on .NET Standard 2.0 or 2.1 even with Microsoft.Bcl.AsyncInterfaces installed #483

@alastairlundy

Description

@alastairlundy

Describe the bug

What the bug is:
Task.WhenEach is not polyfilled by Polyfill on .NET Standard 2.0 and .NET Standard 2.1 even when Microsoft.Bcl.AsyncInterfaces is installed.

What I expected to happen:
To have Task.WhenEach polyfilled for any TFM before .NET 9, including .NET Standard 2.0 when the Microsoft.Bcl.AsyncInterfaces package is installed and .NET Standard 2.1 regardless of whether it is installed (2.1 and .NET Core 3.0+ don't need the Bcl AsyncInterfaces package) .

I believe it's related to this code specifically in the TaskWhenEachPolyfill.cs file:

#if !NET9_0_OR_GREATER && (NET5_0_OR_GREATER || NETCOREAPP3_0_OR_GREATER) && FeatureAsyncInterfaces

Also for what it's worth, Jetbrains Rider shows the Tests project doesn't seem to be using the local version of Polyfill but a version from NuGet instead. Running dotnet nuget why Polyfill on the Tests project doesn't reveal any usage so I don't know how accurate Rider is being in this case.

Screenshot of some Nuget packages installed in Polyfill Tests project

Minimal Repro

Minimal repro ZIP file

TaskWhenEachMinimalRepro.zip

Submit a PR that fixes the bug

I've tried fixing it but have been unsuccessful to get it working on .NET Standard 2.0 thus far. I've created a draft PR with my progress in #482 . My fixes should in theory work on .NET Standard 2.1 but I haven't been able to test that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions