Skip to content

Commit 8e34739

Browse files
authored
Merge pull request #985 from CommunityToolkit/dev/remove-net6
Remove .NET 6 TFM
2 parents 8b94722 + 1586743 commit 8e34739

File tree

19 files changed

+46
-39
lines changed

19 files changed

+46
-39
lines changed

azure-pipelines.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,14 @@ jobs:
3434

3535
# Test solution #
3636

37-
# Run .NET 8 unit tests
37+
# Run .NET 8 unit tests
3838
- script: dotnet test --no-build -c $(Build.Configuration) -f net8.0 -l "trx;LogFileName=VSTestResults_net8.0.trx"
3939
displayName: Run .NET 8 unit tests
4040

4141
# Run .NET 7 unit tests
4242
- script: dotnet test --no-build -c $(Build.Configuration) -f net7.0 -l "trx;LogFileName=VSTestResults_net7.0.trx"
4343
displayName: Run .NET 7 unit tests
4444

45-
# Run .NET 6 unit tests
46-
- script: dotnet test --no-build -c $(Build.Configuration) -f net6.0 -l "trx;LogFileName=VSTestResults_net6.0.trx"
47-
displayName: Run .NET 6 unit tests
48-
4945
# Run .NET Framework 4.7.2 unit tests
5046
- script: dotnet test --no-build -c $(Build.Configuration) -f net472 -l "trx;LogFileName=VSTestResults_net472.trx"
5147
displayName: Run .NET Framework 4.7.2 unit tests

src/CommunityToolkit.Common/CommunityToolkit.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/CommunityToolkit.Common/Deferred/EventDeferral.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
using System;
66
using System.ComponentModel;
7+
#if NET8_0_OR_GREATER
8+
using System.Runtime.CompilerServices;
9+
#endif
710
using System.Threading;
811
using System.Threading.Tasks;
912

@@ -16,8 +19,11 @@ namespace CommunityToolkit.Common.Deferred;
1619
/// </summary>
1720
public class EventDeferral : IDisposable
1821
{
19-
// TODO: If/when .NET 6 is base, we can upgrade to non-generic version
22+
#if NET8_0_OR_GREATER
23+
private readonly TaskCompletionSource taskCompletionSource = new();
24+
#else
2025
private readonly TaskCompletionSource<object?> taskCompletionSource = new();
26+
#endif
2127

2228
internal EventDeferral()
2329
{
@@ -26,7 +32,14 @@ internal EventDeferral()
2632
/// <summary>
2733
/// Call when finished with the Deferral.
2834
/// </summary>
29-
public void Complete() => this.taskCompletionSource.TrySetResult(null);
35+
public void Complete()
36+
{
37+
#if NET8_0_OR_GREATER
38+
this.taskCompletionSource.TrySetResult();
39+
#else
40+
this.taskCompletionSource.TrySetResult(null);
41+
#endif
42+
}
3043

3144
/// <summary>
3245
/// Waits for the <see cref="EventDeferral"/> to be completed by the event handler.
@@ -38,9 +51,19 @@ internal EventDeferral()
3851
[Obsolete("This is an internal only method to be used by EventHandler extension classes, public callers should call GetDeferral() instead on the DeferredEventArgs.")]
3952
public async Task WaitForCompletion(CancellationToken cancellationToken)
4053
{
41-
using (cancellationToken.Register(() => this.taskCompletionSource.TrySetCanceled()))
54+
using (cancellationToken.Register(
55+
#if NET8_0_OR_GREATER
56+
callback: static obj => Unsafe.As<EventDeferral>(obj!).taskCompletionSource.TrySetCanceled(),
57+
#else
58+
callback: static obj => ((EventDeferral)obj).taskCompletionSource.TrySetCanceled(),
59+
#endif
60+
state: this))
4261
{
62+
#if NET8_0_OR_GREATER
63+
await this.taskCompletionSource.Task;
64+
#else
4365
_ = await this.taskCompletionSource.Task;
66+
#endif
4467
}
4568
}
4669

src/CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0;net8.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<PropertyGroup>

src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.FeatureSwitches.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<!--
1717
Configuration for the feature switches (to support IL trimming).
1818
See the 'ILLink.Substitutions.xml' file for more details on that.
19-
We only include these on .NET 6 and above (no .xml file otherwise).
19+
We only include these on .NET 8 and above (no .xml file otherwise).
2020
-->
21-
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
21+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
2222

2323
<!-- MVVMTOOLKIT_ENABLE_INOTIFYPROPERTYCHANGING_SUPPORT switch -->
2424
<RuntimeHostConfigurationOption Include="MVVMTOOLKIT_ENABLE_INOTIFYPROPERTYCHANGING_SUPPORT"

src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0;net8.0-windows10.0.17763.0</TargetFrameworks>
4+
<TargetFrameworks>netstandard2.0;netstandard2.1;net8.0;net8.0-windows10.0.17763.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<!--
@@ -55,7 +55,7 @@
5555
</ItemGroup>
5656

5757
<!-- Include the ILLink file (to properly trim configuration switches in publish builds) -->
58-
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
58+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
5959
<EmbeddedResource Include="Properties\ILLink.Substitutions.xml" LogicalName="ILLink.Substitutions.xml" />
6060
</ItemGroup>
6161

src/Directory.Build.targets

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
77
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants>
88
</PropertyGroup>
99

10-
<!-- Configure trimming for projects on .NET 6 and above -->
11-
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">
12-
<IsTrimmable>true</IsTrimmable>
13-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
14-
<EnableAotAnalyzer>true</EnableAotAnalyzer>
15-
<EnableSingleFileAnalyzer>true</EnableSingleFileAnalyzer>
16-
</PropertyGroup>
17-
1810
<!-- Set the AOT property directly on .NET 8 and above -->
1911
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
2012
<IsAotCompatible>true</IsAotCompatible>

tests/CommunityToolkit.Common.UnitTests/CommunityToolkit.Common.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net472;net7.0;net8.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

tests/CommunityToolkit.Diagnostics.UnitTests/CommunityToolkit.Diagnostics.UnitTests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net472;net6.0;net7.0;net8.0</TargetFrameworks>
4+
<TargetFrameworks>net472;net7.0;net8.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>

0 commit comments

Comments
 (0)