diff --git a/Directory.Build.targets b/Directory.Build.targets
index ff177a8a..a073f652 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -59,7 +59,6 @@
$(DefineConstants);SUPPORTS_AUTHORIZATION_MIDDLEWARE
$(DefineConstants);SUPPORTS_BCL_ASYNC_ENUMERABLE
$(DefineConstants);SUPPORTS_BULK_DBSET_OPERATIONS
- $(DefineConstants);SUPPORTS_CHUNK_LINQ_EXTENSION
$(DefineConstants);SUPPORTS_DBSET_VALUETASK_FINDASYNC
$(DefineConstants);SUPPORTS_ENDPOINT_ROUTING
$(DefineConstants);SUPPORTS_ENVIRONMENT_PROCESS_PATH
diff --git a/Directory.Packages.props b/Directory.Packages.props
index f93d0dd3..5915d160 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -53,7 +53,7 @@
Note: OpenIddict uses Meziantou.Polyfill to dynamically generate polyfills for types that are not available
on some of the targeted TFMs (e.g Index, Range or nullable attributes on .NET Framework/.NET Standard).
-->
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs b/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs
index cce7a9c2..940c0c90 100644
--- a/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs
+++ b/shared/OpenIddict.Extensions/OpenIddictPolyfills.cs
@@ -4,8 +4,6 @@
* the license and the contributors participating to this project.
*/
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography.X509Certificates;
@@ -17,58 +15,6 @@ namespace OpenIddict.Extensions;
///
internal static class OpenIddictPolyfills
{
- extension(ArgumentOutOfRangeException)
- {
- /// Throws an if is negative.
- /// The argument to validate as non-negative.
- /// The name of the parameter with which corresponds.
- public static void ThrowIfNegative(T value, [CallerArgumentExpression(nameof(value))] string? paramName = null)
- where T : struct, IComparable
- {
- switch (value)
- {
- case byte or ushort or uint or ulong or char:
- return;
- case sbyte n:
- if (n < 0)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
- case short n:
- if (n < 0)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
- case int n:
- if (n < 0)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
- case long n:
- if (n < 0L)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
-
- case float n:
- if (n < 0F)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
- case double n:
- if (n < 0D)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
- case decimal n:
- if (n < 0M)
- ThrowArgumentOutOfRangeException(paramName, value);
- return;
- default:
- throw new InvalidOperationException($"Invalid type '{typeof(T).AssemblyQualifiedName}' for {paramName}.");
- }
-
- static void ThrowArgumentOutOfRangeException(string? paramName, object value)
- {
- throw new ArgumentOutOfRangeException(paramName, value, $"{paramName} ('{value}') must not be negative.");
- }
- }
- }
-
extension(Convert)
{
#if !SUPPORTS_HEXADECIMAL_STRING_CONVERSION
@@ -98,78 +44,6 @@ internal static class OpenIddictPolyfills
#endif
}
- extension(IEnumerable source)
- {
-#if !SUPPORTS_CHUNK_LINQ_EXTENSION
- ///
- /// Split the elements of a sequence into chunks of size at most .
- ///
- ///
- /// Every chunk except the last will be of size .
- /// The last chunk will contain the remaining elements and may be of a smaller size.
- ///
- /// Maximum size of each chunk.
- ///
- /// An that contains the elements of the input
- /// sequence split into chunks of size .
- ///
- public IEnumerable Chunk(int size)
- {
- // Note: this polyfill was directly copied from .NET's source code:
- // https://github.com/dotnet/runtime/blob/main/src/libraries/System.Linq/src/System/Linq/Chunk.cs.
-
- using IEnumerator enumerator = source.GetEnumerator();
-
- if (enumerator.MoveNext())
- {
- var count = Math.Min(size, 4);
- int index;
-
- do
- {
- var array = new TSource[count];
-
- array[0] = enumerator.Current;
- index = 1;
-
- if (size != array.Length)
- {
- for (; index < size && enumerator.MoveNext(); index++)
- {
- if (index >= array.Length)
- {
- count = (int) Math.Min((uint) size, 2 * (uint) array.Length);
- Array.Resize(ref array, count);
- }
-
- array[index] = enumerator.Current;
- }
- }
-
- else
- {
- var local = array;
- Debug.Assert(local.Length == size);
- for (; (uint) index < (uint) local.Length && enumerator.MoveNext(); index++)
- {
- local[index] = enumerator.Current;
- }
- }
-
- if (index != array.Length)
- {
- Array.Resize(ref array, index);
- }
-
- yield return array;
- }
-
- while (index >= size && enumerator.MoveNext());
- }
- }
-#endif
- }
-
extension(OperatingSystem)
{
#if !SUPPORTS_OPERATING_SYSTEM_VERSIONS_COMPARISON