Skip to content

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

@jnm2

Description

@jnm2

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));
    }
}

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions