diff --git a/CommunityToolkit.Common/CommunityToolkit.Common.csproj b/CommunityToolkit.Common/CommunityToolkit.Common.csproj index 7f9e307f..b9b9833c 100644 --- a/CommunityToolkit.Common/CommunityToolkit.Common.csproj +++ b/CommunityToolkit.Common/CommunityToolkit.Common.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net5.0 + netstandard2.0;netstandard2.1;net6.0 @@ -14,8 +14,8 @@ Incremental;Loading;Collection;IncrementalLoadingCollection;String;Array;Extensions;Helpers - - + + NETSTANDARD2_1_OR_GREATER diff --git a/CommunityToolkit.Common/Deferred/EventDeferral.cs b/CommunityToolkit.Common/Deferred/EventDeferral.cs index 32999e35..856ff6eb 100644 --- a/CommunityToolkit.Common/Deferred/EventDeferral.cs +++ b/CommunityToolkit.Common/Deferred/EventDeferral.cs @@ -16,7 +16,7 @@ namespace CommunityToolkit.Common.Deferred; /// public class EventDeferral : IDisposable { - //// TODO: If/when .NET 5 is base, we can upgrade to non-generic version + //// TODO: If/when .NET 6 is base, we can upgrade to non-generic version private readonly TaskCompletionSource _taskCompletionSource = new(); internal EventDeferral() diff --git a/CommunityToolkit.Common/Extensions/TaskExtensions.cs b/CommunityToolkit.Common/Extensions/TaskExtensions.cs index c790db1c..c6f291cc 100644 --- a/CommunityToolkit.Common/Extensions/TaskExtensions.cs +++ b/CommunityToolkit.Common/Extensions/TaskExtensions.cs @@ -39,7 +39,7 @@ public static class TaskExtensions { // We need an explicit check to ensure the input task is not the cached // Task.CompletedTask instance, because that can internally be stored as - // a Task for some given T (eg. on .NET 5 it's VoidTaskResult), which + // a Task for some given T (eg. on .NET 6 it's VoidTaskResult), which // would cause the following code to return that result instead of null. if (task != Task.CompletedTask) { diff --git a/CommunityToolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs b/CommunityToolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs index e2ce2314..a05d197d 100644 --- a/CommunityToolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs +++ b/CommunityToolkit.Diagnostics/Attributes/SkipLocalsInitAttribute.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if !NET5_0 +#if !NET6_0_OR_GREATER namespace System.Runtime.CompilerServices; diff --git a/CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj b/CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj index ae0ad2ef..5e8981a2 100644 --- a/CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj +++ b/CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net5.0 + netstandard2.0;netstandard2.1;net6.0 @@ -34,7 +34,7 @@ - + NETSTANDARD2_1_OR_GREATER diff --git a/CommunityToolkit.HighPerformance/Attributes/SkipLocalsInitAttribute.cs b/CommunityToolkit.HighPerformance/Attributes/SkipLocalsInitAttribute.cs index 50303a27..fcad3701 100644 --- a/CommunityToolkit.HighPerformance/Attributes/SkipLocalsInitAttribute.cs +++ b/CommunityToolkit.HighPerformance/Attributes/SkipLocalsInitAttribute.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if !NET5_0 +#if !NET6_0_OR_GREATER namespace System.Runtime.CompilerServices; diff --git a/CommunityToolkit.HighPerformance/Buffers/ArrayPoolBufferWriter{T}.cs b/CommunityToolkit.HighPerformance/Buffers/ArrayPoolBufferWriter{T}.cs index d8932b9e..e0112cf2 100644 --- a/CommunityToolkit.HighPerformance/Buffers/ArrayPoolBufferWriter{T}.cs +++ b/CommunityToolkit.HighPerformance/Buffers/ArrayPoolBufferWriter{T}.cs @@ -9,7 +9,11 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using CommunityToolkit.HighPerformance.Buffers.Views; -using CommunityToolkit.HighPerformance.Helpers.Internals; +#if NET6_0_OR_GREATER +using BitOperations = System.Numerics.BitOperations; +#else +using BitOperations = CommunityToolkit.HighPerformance.Helpers.Internals.BitOperations; +#endif namespace CommunityToolkit.HighPerformance.Buffers; @@ -283,7 +287,7 @@ private void CheckBufferAndEnsureCapacity(int sizeHint) [MethodImpl(MethodImplOptions.NoInlining)] private void ResizeBuffer(int sizeHint) { - int minimumSize = this.index + sizeHint; + uint minimumSize = (uint)this.index + (uint)sizeHint; // The ArrayPool class has a maximum threshold of 1024 * 1024 for the maximum length of // pooled arrays, and once this is exceeded it will just allocate a new array every time @@ -292,10 +296,10 @@ private void ResizeBuffer(int sizeHint) // use is bigger than that threshold don't end up causing a resize every single time. if (minimumSize > 1024 * 1024) { - minimumSize = BitOperations.RoundUpPowerOfTwo(minimumSize); + minimumSize = BitOperations.RoundUpToPowerOf2(minimumSize); } - this.pool.Resize(ref this.array, minimumSize); + this.pool.Resize(ref this.array, (int)minimumSize); } /// diff --git a/CommunityToolkit.HighPerformance/Buffers/StringPool.cs b/CommunityToolkit.HighPerformance/Buffers/StringPool.cs index fc8fb710..6f132abe 100644 --- a/CommunityToolkit.HighPerformance/Buffers/StringPool.cs +++ b/CommunityToolkit.HighPerformance/Buffers/StringPool.cs @@ -8,7 +8,11 @@ using System.Runtime.CompilerServices; using System.Text; using CommunityToolkit.HighPerformance.Helpers; +#if NET6_0_OR_GREATER +using BitOperations = System.Numerics.BitOperations; +#else using BitOperations = CommunityToolkit.HighPerformance.Helpers.Internals.BitOperations; +#endif namespace CommunityToolkit.HighPerformance.Buffers; @@ -66,13 +70,13 @@ public StringPool(int minimumSize) minimumSize = Math.Max(minimumSize, MinimumSize); // Calculates the rounded up factors for a specific size/factor pair - static void FindFactors(int size, int factor, out int x, out int y) + static void FindFactors(int size, int factor, out uint x, out uint y) { double a = Math.Sqrt((double)size / factor); double b = factor * a; - x = BitOperations.RoundUpPowerOfTwo((int)a); - y = BitOperations.RoundUpPowerOfTwo((int)b); + x = BitOperations.RoundUpToPowerOf2((uint)a); + y = BitOperations.RoundUpToPowerOf2((uint)b); } // We want to find two powers of 2 factors that produce a number @@ -84,13 +88,13 @@ static void FindFactors(int size, int factor, out int x, out int y) // as well as the multithreading performance when locking on maps. // We still want to contraint this number to avoid situations where we // have a way too high number of maps compared to total size. - FindFactors(minimumSize, 2, out int x2, out int y2); - FindFactors(minimumSize, 3, out int x3, out int y3); - FindFactors(minimumSize, 4, out int x4, out int y4); + FindFactors(minimumSize, 2, out uint x2, out uint y2); + FindFactors(minimumSize, 3, out uint x3, out uint y3); + FindFactors(minimumSize, 4, out uint x4, out uint y4); - int p2 = x2 * y2; - int p3 = x3 * y3; - int p4 = x4 * y4; + uint p2 = x2 * y2; + uint p3 = x3 * y3; + uint p4 = x4 * y4; if (p3 < p2) { @@ -113,12 +117,12 @@ static void FindFactors(int size, int factor, out int x, out int y) // This lets us lock on each individual maps when retrieving a string instance. foreach (ref FixedSizePriorityMap map in span) { - map = new FixedSizePriorityMap(y2); + map = new FixedSizePriorityMap((int)y2); } - this.numberOfMaps = x2; + this.numberOfMaps = (int)x2; - Size = p2; + Size = (int)p2; } /// diff --git a/CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj b/CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj index 150f4eb8..48fd403c 100644 --- a/CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj +++ b/CommunityToolkit.HighPerformance/CommunityToolkit.HighPerformance.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0 + netstandard2.0;netstandard2.1;netcoreapp3.1;net6.0 @@ -45,9 +45,9 @@ - + - + NETSTANDARD2_1_OR_GREATER diff --git a/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.1D.cs b/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.1D.cs index c13bc580..c38872ae 100644 --- a/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.1D.cs +++ b/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.1D.cs @@ -33,7 +33,7 @@ public static partial class ArrayExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T DangerousGetReference(this T[] array) { -#if NET5_0 +#if NET6_0_OR_GREATER return ref MemoryMarshal.GetArrayDataReference(array); #elif NETCOREAPP3_1 RawArrayData? arrayData = Unsafe.As(array)!; @@ -59,7 +59,7 @@ public static ref T DangerousGetReference(this T[] array) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T DangerousGetReferenceAt(this T[] array, int i) { -#if NET5_0 +#if NET6_0_OR_GREATER ref T r0 = ref MemoryMarshal.GetArrayDataReference(array); ref T ri = ref Unsafe.Add(ref r0, (nint)(uint)i); diff --git a/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.2D.cs b/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.2D.cs index e8d93edd..b07abf79 100644 --- a/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.2D.cs +++ b/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.2D.cs @@ -32,7 +32,9 @@ public static partial class ArrayExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T DangerousGetReference(this T[,] array) { -#if NETCOREAPP3_1 +#if NET6_0_OR_GREATER + return ref Unsafe.As(ref MemoryMarshal.GetArrayDataReference(array)); +#elif NETCOREAPP3_1 RawArray2DData? arrayData = Unsafe.As(array)!; ref T r0 = ref Unsafe.As(ref arrayData.Data); @@ -62,7 +64,14 @@ public static ref T DangerousGetReference(this T[,] array) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T DangerousGetReferenceAt(this T[,] array, int i, int j) { -#if NETCOREAPP3_1 +#if NET6_0_OR_GREATER + int width = array.GetLength(1); + nint index = ((nint)(uint)i * (nint)(uint)width) + (nint)(uint)j; + ref T r0 = ref Unsafe.As(ref MemoryMarshal.GetArrayDataReference(array)); + ref T ri = ref Unsafe.Add(ref r0, index); + + return ref ri; +#elif NETCOREAPP3_1 RawArray2DData? arrayData = Unsafe.As(array)!; nint offset = ((nint)(uint)i * (nint)(uint)arrayData.Width) + (nint)(uint)j; ref T r0 = ref Unsafe.As(ref arrayData.Data); diff --git a/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.3D.cs b/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.3D.cs index e066866e..e472847c 100644 --- a/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.3D.cs +++ b/CommunityToolkit.HighPerformance/Extensions/ArrayExtensions.3D.cs @@ -31,7 +31,9 @@ public static partial class ArrayExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T DangerousGetReference(this T[,,] array) { -#if NETCOREAPP3_1 +#if NET6_0_OR_GREATER + return ref Unsafe.As(ref MemoryMarshal.GetArrayDataReference(array)); +#elif NETCOREAPP3_1 RawArray3DData? arrayData = Unsafe.As(array)!; ref T r0 = ref Unsafe.As(ref arrayData.Data); @@ -62,7 +64,17 @@ public static ref T DangerousGetReference(this T[,,] array) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref T DangerousGetReferenceAt(this T[,,] array, int i, int j, int k) { -#if NETCOREAPP3_1 +#if NET6_0_OR_GREATER + int height = array.GetLength(1); + int width = array.GetLength(2); + nint index = + ((nint)(uint)i * (nint)(uint)height * (nint)(uint)width) + + ((nint)(uint)j * (nint)(uint)width) + (nint)(uint)k; + ref T r0 = ref Unsafe.As(ref MemoryMarshal.GetArrayDataReference(array)); + ref T ri = ref Unsafe.Add(ref r0, index); + + return ref ri; +#elif NETCOREAPP3_1 RawArray3DData? arrayData = Unsafe.As(array)!; nint offset = ((nint)(uint)i * (nint)(uint)arrayData.Height * (nint)(uint)arrayData.Width) + diff --git a/CommunityToolkit.HighPerformance/Extensions/ListExtensions.cs b/CommunityToolkit.HighPerformance/Extensions/ListExtensions.cs index 328e76e5..655e9c3b 100644 --- a/CommunityToolkit.HighPerformance/Extensions/ListExtensions.cs +++ b/CommunityToolkit.HighPerformance/Extensions/ListExtensions.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NET5_0 +#if NET6_0_OR_GREATER using System; using System.Collections.Generic; diff --git a/CommunityToolkit.HighPerformance/Extensions/NullableExtensions.cs b/CommunityToolkit.HighPerformance/Extensions/NullableExtensions.cs index aaf723c7..bcd46242 100644 --- a/CommunityToolkit.HighPerformance/Extensions/NullableExtensions.cs +++ b/CommunityToolkit.HighPerformance/Extensions/NullableExtensions.cs @@ -2,11 +2,12 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// This extension is restricted to the .NET 5 because it shares the same BCL +// This extension is restricted to the .NET 6 because it shares the same BCL // across all targets, ensuring that the layout of our Nullable mapping type // will be correct. Exposing this API on older targets (especially .NET Standard) // is not guaranteed to be correct and could result in invalid memory accesses. -#if NET5_0 + +#if NET6_0_OR_GREATER using System; using System.Runtime.CompilerServices; diff --git a/CommunityToolkit.HighPerformance/Extensions/StringExtensions.cs b/CommunityToolkit.HighPerformance/Extensions/StringExtensions.cs index 95e450fa..ff750824 100644 --- a/CommunityToolkit.HighPerformance/Extensions/StringExtensions.cs +++ b/CommunityToolkit.HighPerformance/Extensions/StringExtensions.cs @@ -28,7 +28,7 @@ public static class StringExtensions [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref char DangerousGetReference(this string text) { -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER return ref Unsafe.AsRef(text.GetPinnableReference()); #else return ref MemoryMarshal.GetReference(text.AsSpan()); @@ -46,7 +46,7 @@ public static ref char DangerousGetReference(this string text) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ref char DangerousGetReferenceAt(this string text, int i) { -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER ref char r0 = ref Unsafe.AsRef(text.GetPinnableReference()); #else ref char r0 = ref MemoryMarshal.GetReference(text.AsSpan()); diff --git a/CommunityToolkit.HighPerformance/Helpers/BitHelper.cs b/CommunityToolkit.HighPerformance/Helpers/BitHelper.cs index 17301fa7..41645f80 100644 --- a/CommunityToolkit.HighPerformance/Helpers/BitHelper.cs +++ b/CommunityToolkit.HighPerformance/Helpers/BitHelper.cs @@ -4,7 +4,7 @@ using System.Diagnostics.Contracts; using System.Runtime.CompilerServices; -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER using System.Runtime.Intrinsics.X86; #endif @@ -233,7 +233,7 @@ public static unsafe uint SetFlag(uint value, int n, bool flag) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint ExtractRange(uint value, byte start, byte length) { -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER if (Bmi1.IsSupported) { return Bmi1.BitFieldExtract(value, start, length); @@ -280,7 +280,7 @@ public static uint SetRange(uint value, byte start, byte length, uint flags) uint loadMask = highBits << start; uint storeMask = (flags & highBits) << start; -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER if (Bmi1.IsSupported) { return Bmi1.AndNot(loadMask, value) | storeMask; @@ -400,7 +400,7 @@ public static unsafe ulong SetFlag(ulong value, int n, bool flag) [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong ExtractRange(ulong value, byte start, byte length) { -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER if (Bmi1.X64.IsSupported) { return Bmi1.X64.BitFieldExtract(value, start, length); @@ -447,7 +447,7 @@ public static ulong SetRange(ulong value, byte start, byte length, ulong flags) ulong loadMask = highBits << start; ulong storeMask = (flags & highBits) << start; -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER if (Bmi1.X64.IsSupported) { return Bmi1.X64.AndNot(loadMask, value) | storeMask; diff --git a/CommunityToolkit.HighPerformance/Helpers/Internals/BitOperations.cs b/CommunityToolkit.HighPerformance/Helpers/Internals/BitOperations.cs index 6f4a06e8..b2ec8f71 100644 --- a/CommunityToolkit.HighPerformance/Helpers/Internals/BitOperations.cs +++ b/CommunityToolkit.HighPerformance/Helpers/Internals/BitOperations.cs @@ -2,9 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.Contracts; +#if !NET6_0_OR_GREATER + using System.Runtime.CompilerServices; -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1 +using System.Runtime.Intrinsics.X86; using static System.Numerics.BitOperations; #endif @@ -17,26 +19,42 @@ namespace CommunityToolkit.HighPerformance.Helpers.Internals; internal static class BitOperations { /// - /// Rounds up an value to a power of 2. + /// Round the given integral value up to a power of 2. /// - /// The input value to round up. - /// The smallest power of two greater than or equal to . - [Pure] + /// The value. + /// + /// The smallest power of 2 which is greater than or equal to . + /// If is 0 or the result overflows, returns 0. + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static int RoundUpPowerOfTwo(int x) + public static unsafe uint RoundUpToPowerOf2(uint value) { -#if NETCOREAPP3_1 || NET5_0 - return 1 << (32 - LeadingZeroCount((uint)(x - 1))); -#else - x--; - x |= x >> 1; - x |= x >> 2; - x |= x >> 4; - x |= x >> 8; - x |= x >> 16; - x++; - - return x; +#if NETCOREAPP3_1 + if (Lzcnt.IsSupported) + { + if (sizeof(nint) == 8) + { + return (uint)(0x1_0000_0000ul >> LeadingZeroCount(value - 1)); + } + else + { + int shift = 32 - LeadingZeroCount(value - 1); + + return (1u ^ (uint)(shift >> 5)) << shift; + } + } #endif + + // Based on https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 + --value; + value |= value >> 1; + value |= value >> 2; + value |= value >> 4; + value |= value >> 8; + value |= value >> 16; + + return value + 1; } } + +#endif diff --git a/CommunityToolkit.HighPerformance/Helpers/Internals/RuntimeHelpers.cs b/CommunityToolkit.HighPerformance/Helpers/Internals/RuntimeHelpers.cs index b899af0d..4bcffae8 100644 --- a/CommunityToolkit.HighPerformance/Helpers/Internals/RuntimeHelpers.cs +++ b/CommunityToolkit.HighPerformance/Helpers/Internals/RuntimeHelpers.cs @@ -79,6 +79,7 @@ public static nint GetArrayNativeLength(Array array) return (nint)array.LongLength; } +#if !NETCOREAPP3_1_OR_GREATER /// /// Gets the byte offset to the first element in a SZ array. /// @@ -90,6 +91,7 @@ public static IntPtr GetArrayDataByteOffset() { return TypeInfo.ArrayDataByteOffset; } +#endif /// /// Gets the byte offset to the first element in a 2D array. diff --git a/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj b/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj index 32368688..6e930106 100644 --- a/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj +++ b/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj @@ -1,7 +1,7 @@ - netstandard2.0;netstandard2.1;net5.0 + netstandard2.0;netstandard2.1;net6.0 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d9ea74a7..55c8117d 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,9 +40,9 @@ jobs: - powershell: dotnet build -c Release displayName: Build solution - # Run .NET 5 tests - - powershell: dotnet test --logger "trx;LogFileName=VsTestResultsNet5.trx" --framework net5.0 --configuration Release - displayName: Run .NET 5 unit tests + # Run .NET 6 tests + - powershell: dotnet test --logger "trx;LogFileName=VsTestResultsNet6.trx" --framework net6.0 --configuration Release + displayName: Run .NET 6 unit tests # Run .NET Core 3.1 tests - powershell: dotnet test --logger "trx;LogFileName=VsTestResultsNetCore31.trx" --framework netcoreapp3.1 --configuration Release diff --git a/tests/CommunityToolkit.Common.UnitTests/CommunityToolkit.Common.UnitTests.csproj b/tests/CommunityToolkit.Common.UnitTests/CommunityToolkit.Common.UnitTests.csproj index 9aee49a2..d75d3811 100644 --- a/tests/CommunityToolkit.Common.UnitTests/CommunityToolkit.Common.UnitTests.csproj +++ b/tests/CommunityToolkit.Common.UnitTests/CommunityToolkit.Common.UnitTests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net6.0 diff --git a/tests/CommunityToolkit.Diagnostics.UnitTests/CommunityToolkit.Diagnostics.UnitTests.csproj b/tests/CommunityToolkit.Diagnostics.UnitTests/CommunityToolkit.Diagnostics.UnitTests.csproj index b0bbbdfa..2c5988e6 100644 --- a/tests/CommunityToolkit.Diagnostics.UnitTests/CommunityToolkit.Diagnostics.UnitTests.csproj +++ b/tests/CommunityToolkit.Diagnostics.UnitTests/CommunityToolkit.Diagnostics.UnitTests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net6.0 diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/CommunityToolkit.HighPerformance.UnitTests.csproj b/tests/CommunityToolkit.HighPerformance.UnitTests/CommunityToolkit.HighPerformance.UnitTests.csproj index 022c59f5..cf334d28 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/CommunityToolkit.HighPerformance.UnitTests.csproj +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/CommunityToolkit.HighPerformance.UnitTests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net6.0 diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/Extensions/Test_ArrayExtensions.2D.cs b/tests/CommunityToolkit.HighPerformance.UnitTests/Extensions/Test_ArrayExtensions.2D.cs index 73069f36..44fb8aad 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/Extensions/Test_ArrayExtensions.2D.cs +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/Extensions/Test_ArrayExtensions.2D.cs @@ -419,7 +419,7 @@ public void Test_ArrayExtensions_2D_GetColumn_Empty() _ = Assert.ThrowsException(() => array.GetColumn(0).ToArray()); } -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER [TestMethod] public void Test_ArrayExtensions_2D_AsSpan_Empty() { diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_HashCode{T}.cs b/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_HashCode{T}.cs index 2e5a9fae..fff1ca57 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_HashCode{T}.cs +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_HashCode{T}.cs @@ -56,7 +56,7 @@ public void Test_HashCodeOfT_VectorUnsupportedTypes_TestRepeat() TestForType(); } -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER [TestMethod] public void Test_HashCodeOfT_ManagedType_TestRepeat() { diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For.cs b/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For.cs index 0fd4b3b2..7890c83a 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For.cs +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For.cs @@ -38,7 +38,7 @@ public unsafe void Test_ParallelHelper_ForWithIndices() } } -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER [TestMethod] [ExpectedException(typeof(ArgumentException))] public void Test_ParallelHelper_ForInvalidRange_FromEnd() diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For2D.cs b/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For2D.cs index e1474d28..6226967f 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For2D.cs +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/Helpers/Test_ParallelHelper.For2D.cs @@ -50,7 +50,7 @@ public unsafe void Test_ParallelHelper_For2DWithIndices() } } -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER [TestMethod] [ExpectedException(typeof(ArgumentException))] public void Test_ParallelHelper_For2DInvalidRange_FromEnd() diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableReadOnlyRef{T}.cs b/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableReadOnlyRef{T}.cs index dae42736..bcf9ac5d 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableReadOnlyRef{T}.cs +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableReadOnlyRef{T}.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER using System; using System.Runtime.CompilerServices; diff --git a/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableRef{T}.cs b/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableRef{T}.cs index 16f2d98d..b10ae880 100644 --- a/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableRef{T}.cs +++ b/tests/CommunityToolkit.HighPerformance.UnitTests/Test_NullableRef{T}.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#if NETCOREAPP3_1 || NET5_0 +#if NETCOREAPP3_1_OR_GREATER using System; using System.Runtime.CompilerServices; diff --git a/tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests.csproj b/tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests.csproj index ed4dc24d..ab59a75f 100644 --- a/tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests.csproj +++ b/tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net6.0 diff --git a/tests/CommunityToolkit.Mvvm.UnitTests/CommunityToolkit.Mvvm.UnitTests.csproj b/tests/CommunityToolkit.Mvvm.UnitTests/CommunityToolkit.Mvvm.UnitTests.csproj index 3279833d..dc144b2c 100644 --- a/tests/CommunityToolkit.Mvvm.UnitTests/CommunityToolkit.Mvvm.UnitTests.csproj +++ b/tests/CommunityToolkit.Mvvm.UnitTests/CommunityToolkit.Mvvm.UnitTests.csproj @@ -1,7 +1,7 @@ - net472;netcoreapp3.1;net5.0 + net472;netcoreapp3.1;net6.0