Skip to content

Remove temporary workaround and reinstate net462 target with official System.ValueTuple 4.6.2 dependency#36

Merged
buvinghausen merged 5 commits intomasterfrom
copilot/fix-compile-error-tasktupleawaiter
Mar 7, 2026
Merged

Remove temporary workaround and reinstate net462 target with official System.ValueTuple 4.6.2 dependency#36
buvinghausen merged 5 commits intomasterfrom
copilot/fix-compile-error-tasktupleawaiter

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 6, 2026

  • Revert CI workflow files to original state (net9/net10 SDK installs preserved for test coverage)
  • Fix src/Directory.Build.props to use a fixed TFM list (not appending from root) — removes the temporary workaround that dropped net462; reorder as netstandard2.0;net462;net8.0 (base case first, then ascending version order)
  • Add System.ValueTuple 4.6.2 PackageReference for net462 in src/TaskTupleAwaiter/TaskTupleAwaiter.csproj without historical commentary
Original prompt

This section details on the original issue you should resolve

<issue_title>Compile error when TaskTupleAwaiter is used with System.ValueTuple 4.6.1 on .NET Framework</issue_title>
<issue_description>System.Text.Json 10.0.0 depends on System.ValueTuple 4.6.1. If you're on .NET Framework and you want to use System.Text.Json 10.0.0 and you use TaskTupleAwaiter, you will hit a slew of compile errors per await:

error CS0012: The type 'ValueTuple<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type '(, )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type '(, , )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type '(, , , )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type '(, , , , )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type '(, , , , , )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type '(, , , , , , )' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error CS0012: The type 'ValueTuple<,,,,,,,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ValueTuple, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.

This only affects TaskTupleAwaiter v1.1.0+. v1.0.0 and v1.0.1 do not have this problem.
This also only affects the latest System.ValueTuple (4.6.1). The previous System.ValueTuple (4.5.0) does not have this problem.

Repro

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="System.ValueTuple" Version="4.6.1" />
    <PackageReference Include="TaskTupleAwaiter" Version="2.1.1" />
  </ItemGroup>

</Project>
using System.Threading.Tasks;

class C
{
    async Task M()
    {
        await (Task.FromResult(1), Task.FromResult(2));
    }
}
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@jnm2</author><body>
In working scenario 1 (System.ValueTuple 4.6.1, TaskTupleAwaiter 1.0.1), the Csc MSBuild task references include a netstandard2.0 build of TaskTupleAwaiter.dll and the netstandard.dll facade.

In working scenario 2 (System.ValueTuple 4.5.0, TaskTupleAwaiter 1.0.1), the Csc MSBuild task references include a net462 build of TaskTupleAwaiter.dll and the net47 ref assembly for System.ValueTuple.dll.

In the broken scenario (System.ValueTuple 4.6.1, TaskTupleAwaiter 2.1.1), the Csc MSBuild task references include a net462 build of TaskTupleAwaiter.dll and do not include any System.ValueTuple.dll.

</body></comment_new>
<comment_new><author>@jnm2</author><body>
Unlike 4.3.1 and 4.5.0, System.ValueTuple 4.6.1 includes an empty net471 folder which is why no reference assembly is added. This may be a legitimate package authoring bug in System.ValueTuple 4.6.1. (Not the first time this type of issue has raised its head with either this type or System.ValueTask.)

Despite this likely being a System.ValueTuple bug, there are options on the TaskTupleAwaiter side:

- Use a netstandard2.0 build instead of a net462 build. (Why not, anyway?)
- Add a net471 framework target to TaskTupleAwaiter.
- Possibly, update the System.ValueTuple dependency from 4.3.1 to 4.6.1.
</body></comment_new>
<comment_new><author>@jnm2</author><body>
I reported the System.ValueTuple defect at https://github.com/dotnet/maintenance-packages/issues/243.</body></comment_new>
<comment_new><author>@buvinghausen</author><body>
@jnm2 nothing to do on your end but I had some spare time yesterday and so I went ahead and ported the library over to using MTP2 to modernize the testing stack and plugged in Shouldly for assertions.  The only other change was I put a Directory.Build.props file in the parent folder and have both the test & src props files inherit from it so now we have one place to go to maintain the supported TFM array. </body></comment_new>
<comment_new><author>@jnm2</author><body>
@buvinghausen The Shoudly commit https://github.com/buvinghausen/TaskTupleA...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes buvinghausen/TaskTupleAwaiter#34

<!-- START COPILOT CODING AGENT TIPS -->
---

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. [Learn more about Advanced Security.](https://gh.io/cca-advanced-security)

@jnm2
Copy link
Copy Markdown
Collaborator

jnm2 commented Mar 6, 2026

@copilot Don't change the CI workflow. We want to maintain our test coverage on net9 and 10. It's only the nuget package authoring that should be affected by this PR.

- Remove net9.0 and net10.0 targets from root Directory.Build.props (net8.0 already provides compat)
- Add net462 package target to src/Directory.Build.props
- Add System.ValueTuple 4.6.2 dependency for net462 target
- Update CI workflows to use .NET 8.0.* SDK only

Co-authored-by: jnm2 <8040367+jnm2@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compile error with TaskTupleAwaiter and System.ValueTuple Reinstate net462 target and fix System.ValueTuple reference for .NET Framework consumers Mar 6, 2026
Copilot finished work on behalf of jnm2 March 6, 2026 13:06
@jnm2
Copy link
Copy Markdown
Collaborator

jnm2 commented Mar 6, 2026

@copilot The commit title makes it appear that this PR is fixing the bug described in the linked issue, but it is not. The bug is already fixed. A better description is that we are removing our temporary workaround which fixed that bug and replacing it with the official approach.

…list

Co-authored-by: jnm2 <8040367+jnm2@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 6, 2026

@copilot Don't change the CI workflow. We want to maintain our test coverage on net9 and 10. It's only the nuget package authoring that should be affected by this PR.

Done in 9afde45. Reverted both workflow files to their original state. The src/Directory.Build.props now uses a fixed net8.0;netstandard2.0;net462 list (instead of appending to $(TargetFrameworks)) so the NuGet package ships only those three TFMs, while the test project still picks up net9.0 and net10.0 from the root props and gets full coverage on all five targets.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 6, 2026

@copilot The commit title makes it appear that this PR is fixing the bug described in the linked issue, but it is not. The bug is already fixed. A better description is that we are removing our tempor...

Good catch. The temporary workaround was dropping net462 from the package's TargetFrameworks (leaving only netstandard2.0) to avoid the broken System.ValueTuple 4.6.1 reference. This PR removes that workaround and reinstates net462 with an explicit System.ValueTuple 4.6.2 dependency now that the upstream bug is fixed. I've updated the PR description to reflect this framing.

Copilot AI changed the title Reinstate net462 target and fix System.ValueTuple reference for .NET Framework consumers Remove temporary workaround and reinstate net462 target with official System.ValueTuple 4.6.2 dependency Mar 6, 2026
Copilot finished work on behalf of jnm2 March 6, 2026 13:11
jnm2
jnm2 previously requested changes Mar 6, 2026
…g System.ValueTuple 4.6.2 dependency

Co-authored-by: jnm2 <8040367+jnm2@users.noreply.github.com>
Co-authored-by: jnm2 <8040367+jnm2@users.noreply.github.com>
Copilot finished work on behalf of jnm2 March 6, 2026 14:32
@jnm2 jnm2 marked this pull request as ready for review March 6, 2026 14:35
@jnm2 jnm2 dismissed their stale review March 6, 2026 14:36

Addressed

jnm2
jnm2 previously approved these changes Mar 6, 2026
Copy link
Copy Markdown
Collaborator

@jnm2 jnm2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was okayed in #34 by @buvinghausen

@jnm2 jnm2 dismissed their stale review March 6, 2026 19:08

My review doesn't allow merging

@buvinghausen buvinghausen merged commit f151db9 into master Mar 7, 2026
1 check passed
@buvinghausen buvinghausen deleted the copilot/fix-compile-error-tasktupleawaiter branch March 7, 2026 12:45
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.

Compile error when TaskTupleAwaiter is used with System.ValueTuple 4.6.1 on .NET Framework

3 participants