Description
I have this test class (see below).
When I run them with the target frameworks net9.0 and net10.0. The project compiles and the tests are being executed successfully.
When I compile the project with the target framework net8.0, it does not get compiled.
Test Class
namespace FancyTests;
public sealed class CollectionAllTests
{
[Test]
public async ValueTask Foo()
{
List<FancyEnum> cut =
[
FancyEnum.Foo,
FancyEnum.Bar,
FancyEnum.Hello
];
await Assert.That(cut).All(i => i != FancyEnum.World);
}
[Test]
public async Task All_Items_Match()
{
int[] numbers = [2, 4, 6, 8];
await Assert.That(numbers).All(n => n % 2 == 0);
}
[Test]
public async Task All_Items_Match_List()
{
List<int> numbers = [2, 4, 6, 8];
await Assert.That(numbers).All(n => n % 2 == 0);
}
[Test]
public async Task All_Items_Match_List_Array()
{
int[] numbers = new List<int>([2, 4, 6, 8]).ToArray();
await Assert.That(numbers).All(n => n % 2 == 0);
}
}
public enum FancyEnum
{
Foo = 0,
Bar = 1,
Hello = 2,
World = 3,
}
Result of .NET 9.0
dotnet run
████████╗██╗ ██╗███╗ ██╗██╗████████╗
╚══██╔══╝██║ ██║████╗ ██║██║╚══██╔══╝
██║ ██║ ██║██╔██╗ ██║██║ ██║
██║ ██║ ██║██║╚██╗██║██║ ██║
██║ ╚██████╔╝██║ ╚████║██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝
TUnit v1.54.0.0 | 64-bit | Microsoft Windows 10.0.26200 | win-x64 | .NET 9.0.17 | Microsoft Testing Platform v2.2.3
Engine Mode: SourceGenerated
In process file artifacts produced:
- bin\Debug\net9.0\TestResults\FancyTests-windows-net9.0-report.html
Test run summary: Passed! - bin\Debug\net9.0\FancyTests.dll (net9.0|x64)
total: 4
failed: 0
succeeded: 4
skipped: 0
duration: 401ms
Expected Behavior
The test class gets compiled for all three target frameworks (8,9,10) and its tests are being executed successfully.
Actual Behavior
The project gets not compiled for .NET 8.0.
Steps to Reproduce
- Create a project with this content
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="TUnit" Version="1.54.0" />
</ItemGroup>
</Project>
- Create a CS file with the content from the description
- Repeat for each target framework
- Execute
dotnet run for the project
- Select the target framework
- Observe
TUnit Version
1.54.0
.NET Version
net8.0;net9.0;net10.0
Operating System
Windows
IDE / Test Runner
dotnet CLI (dotnet test / dotnet run)
Error Output / Stack Trace
dotnet run
FancyTests net8.0 failed with 2 error(s) (0,7s)
C:\Users\zzz\Downloads\ic-tunit\FancyTests\CollectionAllTests.cs(15,32): error CS0411: The type arguments for method 'ImmutableArrayExtensions.All<T>(ImmutableArray<T>, Func<T, bool>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
C:\Users\zzz\Downloads\ic-tunit\FancyTests\CollectionAllTests.cs(31,36): error CS0411: The type arguments for method 'ImmutableArrayExtensions.All<T>(ImmutableArray<T>, Func<T, bool>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
The build failed. Fix the build errors and run again.
Additional Context
nothing special; see project file
IDE-Specific Issue?
Description
I have this test class (see below).
When I run them with the target frameworks
net9.0andnet10.0. The project compiles and the tests are being executed successfully.When I compile the project with the target framework
net8.0, it does not get compiled.Test Class
Result of .NET 9.0
Expected Behavior
The test class gets compiled for all three target frameworks (8,9,10) and its tests are being executed successfully.
Actual Behavior
The project gets not compiled for .NET 8.0.
Steps to Reproduce
dotnet runfor the projectTUnit Version
1.54.0
.NET Version
net8.0;net9.0;net10.0
Operating System
Windows
IDE / Test Runner
dotnet CLI (dotnet test / dotnet run)
Error Output / Stack Trace
dotnet run FancyTests net8.0 failed with 2 error(s) (0,7s) C:\Users\zzz\Downloads\ic-tunit\FancyTests\CollectionAllTests.cs(15,32): error CS0411: The type arguments for method 'ImmutableArrayExtensions.All<T>(ImmutableArray<T>, Func<T, bool>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. C:\Users\zzz\Downloads\ic-tunit\FancyTests\CollectionAllTests.cs(31,36): error CS0411: The type arguments for method 'ImmutableArrayExtensions.All<T>(ImmutableArray<T>, Func<T, bool>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. The build failed. Fix the build errors and run again.Additional Context
nothing special; see project file
IDE-Specific Issue?
dotnet testordotnet run, not just in my IDE