From 007f62873c40c0e17b4bf94a030ff71fd0f71abb Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 15 Apr 2026 10:26:04 +1000 Subject: [PATCH] Add RuntimeFeature IsMultithreadingSupported --- apiCount.include.md | 2 +- api_list.include.md | 5 + readme.md | 118 +++++++++--------- src/Consume/Consume.cs | 7 ++ src/Polyfill/RuntimeFeaturePolyfill.cs | 19 +++ src/Split/net10.0/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net471/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net472/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net48/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net481/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net5.0/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net6.0/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net7.0/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net8.0/RuntimeFeaturePolyfill.cs | 14 +++ src/Split/net9.0/RuntimeFeaturePolyfill.cs | 14 +++ .../netcoreapp2.0/RuntimeFeaturePolyfill.cs | 14 +++ .../netcoreapp2.1/RuntimeFeaturePolyfill.cs | 14 +++ .../netcoreapp2.2/RuntimeFeaturePolyfill.cs | 14 +++ .../netcoreapp3.0/RuntimeFeaturePolyfill.cs | 14 +++ .../netcoreapp3.1/RuntimeFeaturePolyfill.cs | 14 +++ .../netstandard2.1/RuntimeFeaturePolyfill.cs | 14 +++ src/Tests/PolyfillTests_RuntimeFeature.cs | 14 +++ 22 files changed, 332 insertions(+), 57 deletions(-) create mode 100644 src/Polyfill/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net10.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net471/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net472/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net48/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net481/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net5.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net6.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net7.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net8.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/net9.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/netcoreapp2.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/netcoreapp2.1/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/netcoreapp2.2/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/netcoreapp3.0/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/netcoreapp3.1/RuntimeFeaturePolyfill.cs create mode 100644 src/Split/netstandard2.1/RuntimeFeaturePolyfill.cs create mode 100644 src/Tests/PolyfillTests_RuntimeFeature.cs diff --git a/apiCount.include.md b/apiCount.include.md index 08995a3a..3e840a37 100644 --- a/apiCount.include.md +++ b/apiCount.include.md @@ -1,4 +1,4 @@ -**API count: 928** +**API count: 929** ### Per Target Framework diff --git a/api_list.include.md b/api_list.include.md index 9e5b820f..1e0094ed 100644 --- a/api_list.include.md +++ b/api_list.include.md @@ -834,6 +834,11 @@ * `bool IsMatch(ReadOnlySpan, string)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex.ismatch?view=net-11.0#system-text-regularexpressions-regex-ismatch(system-readonlyspan((system-char))-system-string)) +#### RuntimeFeature + + * `IsMultithreadingSupported` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.runtimefeature.ismultithreadingsupported?view=net-11.0) + + #### SByte * `bool TryFormat(Span, int, ReadOnlySpan, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.sbyte.tryformat?view=net-11.0#system-sbyte-tryformat(system-span((system-byte))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider)) diff --git a/readme.md b/readme.md index 07037aec..c4f6d046 100644 --- a/readme.md +++ b/readme.md @@ -13,34 +13,34 @@ The package targets `netstandard2.0` and is designed to support the following ru * `uap10` -**API count: 924** +**API count: 929** ### Per Target Framework | Target | APIs | | -- | -- | -| `net461` | 894 | -| `net462` | 894 | -| `net47` | 893 | -| `net471` | 893 | -| `net472` | 889 | -| `net48` | 889 | -| `net481` | 889 | -| `netstandard2.0` | 892 | -| `netstandard2.1` | 722 | -| `netcoreapp2.0` | 815 | -| `netcoreapp2.1` | 734 | -| `netcoreapp2.2` | 734 | -| `netcoreapp3.0` | 680 | -| `netcoreapp3.1` | 679 | -| `net5.0` | 553 | +| `net461` | 899 | +| `net462` | 899 | +| `net47` | 898 | +| `net471` | 897 | +| `net472` | 893 | +| `net48` | 893 | +| `net481` | 893 | +| `netstandard2.0` | 896 | +| `netstandard2.1` | 726 | +| `netcoreapp2.0` | 819 | +| `netcoreapp2.1` | 738 | +| `netcoreapp2.2` | 738 | +| `netcoreapp3.0` | 684 | +| `netcoreapp3.1` | 683 | +| `net5.0` | 556 | | `net6.0` | 462 | | `net7.0` | 314 | | `net8.0` | 196 | | `net9.0` | 127 | | `net10.0` | 75 | | `net11.0` | 57 | -| `uap10.0` | 881 | +| `uap10.0` | 886 | @@ -96,21 +96,21 @@ This project uses features from the current stable SDK and C# language. As such | | Empty Assembly | With Polyfill | Diff | Ensure | ArgumentExceptions | StringInterpolation | Nullability | |----------------|----------------|---------------|-----------|-----------|--------------------|---------------------|-------------| -| netstandard2.0 | 8.0KB | 299.0KB | +291.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| netstandard2.1 | 8.5KB | 251.0KB | +242.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | -| net461 | 8.5KB | 296.5KB | +288.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net462 | 7.0KB | 300.0KB | +293.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | -| net47 | 7.0KB | 300.0KB | +293.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net471 | 8.5KB | 300.0KB | +291.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net472 | 8.5KB | 298.5KB | +290.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net48 | 8.5KB | 298.5KB | +290.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net481 | 8.5KB | 298.5KB | +290.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| netcoreapp2.0 | 9.0KB | 275.0KB | +266.0KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | -| netcoreapp2.1 | 9.0KB | 254.0KB | +245.0KB | +9.0KB | +7.0KB | +9.5KB | +14.0KB | -| netcoreapp2.2 | 9.0KB | 254.0KB | +245.0KB | +9.0KB | +7.0KB | +9.5KB | +14.0KB | -| netcoreapp3.0 | 9.5KB | 245.0KB | +235.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | -| netcoreapp3.1 | 9.5KB | 243.5KB | +234.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net5.0 | 9.5KB | 208.0KB | +198.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netstandard2.0 | 8.0KB | 305.5KB | +297.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netstandard2.1 | 8.5KB | 257.5KB | +249.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net461 | 8.5KB | 303.0KB | +294.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net462 | 7.0KB | 306.5KB | +299.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net47 | 7.0KB | 306.5KB | +299.5KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | +| net471 | 8.5KB | 306.0KB | +297.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net472 | 8.5KB | 305.0KB | +296.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| net48 | 8.5KB | 305.0KB | +296.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| net481 | 8.5KB | 305.0KB | +296.5KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | +| netcoreapp2.0 | 9.0KB | 281.0KB | +272.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netcoreapp2.1 | 9.0KB | 260.5KB | +251.5KB | +9.0KB | +7.0KB | +9.0KB | +14.0KB | +| netcoreapp2.2 | 9.0KB | 260.5KB | +251.5KB | +9.0KB | +7.0KB | +9.0KB | +14.0KB | +| netcoreapp3.0 | 9.5KB | 251.5KB | +242.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netcoreapp3.1 | 9.5KB | 250.0KB | +240.5KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | +| net5.0 | 9.5KB | 213.5KB | +204.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | | net6.0 | 10.0KB | 152.0KB | +142.0KB | +10.0KB | +7.0KB | +512bytes | +4.0KB | | net7.0 | 10.0KB | 117.5KB | +107.5KB | +9.0KB | +5.5KB | +512bytes | +4.0KB | | net8.0 | 9.5KB | 89.0KB | +79.5KB | +9.0KB | +512bytes | +1.0KB | +3.5KB | @@ -123,21 +123,21 @@ This project uses features from the current stable SDK and C# language. As such | | Empty Assembly | With Polyfill | Diff | Ensure | ArgumentExceptions | StringInterpolation | Nullability | |----------------|----------------|---------------|-----------|-----------|--------------------|---------------------|-------------| -| netstandard2.0 | 8.0KB | 436.4KB | +428.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netstandard2.1 | 8.5KB | 362.9KB | +354.4KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net461 | 8.5KB | 434.3KB | +425.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net462 | 7.0KB | 437.8KB | +430.8KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net47 | 7.0KB | 437.6KB | +430.6KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net471 | 8.5KB | 437.6KB | +429.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net472 | 8.5KB | 435.0KB | +426.5KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net48 | 8.5KB | 435.0KB | +426.5KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net481 | 8.5KB | 435.0KB | +426.5KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netcoreapp2.0 | 9.0KB | 402.3KB | +393.3KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | -| netcoreapp2.1 | 9.0KB | 370.1KB | +361.1KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | -| netcoreapp2.2 | 9.0KB | 370.1KB | +361.1KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | -| netcoreapp3.0 | 9.5KB | 351.8KB | +342.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| netcoreapp3.1 | 9.5KB | 350.3KB | +340.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net5.0 | 9.5KB | 297.2KB | +287.7KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netstandard2.0 | 8.0KB | 444.6KB | +436.6KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netstandard2.1 | 8.5KB | 371.2KB | +362.7KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net461 | 8.5KB | 442.9KB | +434.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net462 | 7.0KB | 446.4KB | +439.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net47 | 7.0KB | 446.1KB | +439.1KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | +| net471 | 8.5KB | 445.3KB | +436.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net472 | 8.5KB | 443.2KB | +434.7KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| net48 | 8.5KB | 443.2KB | +434.7KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| net481 | 8.5KB | 443.2KB | +434.7KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp2.0 | 9.0KB | 410.0KB | +401.0KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netcoreapp2.1 | 9.0KB | 378.4KB | +369.4KB | +16.7KB | +8.7KB | +13.9KB | +19.4KB | +| netcoreapp2.2 | 9.0KB | 378.4KB | +369.4KB | +16.7KB | +8.7KB | +13.9KB | +19.4KB | +| netcoreapp3.0 | 9.5KB | 360.1KB | +350.6KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netcoreapp3.1 | 9.5KB | 358.5KB | +349.0KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | +| net5.0 | 9.5KB | 304.3KB | +294.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | net6.0 | 10.0KB | 223.4KB | +213.4KB | +17.7KB | +8.7KB | +1.1KB | +4.7KB | | net7.0 | 10.0KB | 170.2KB | +160.2KB | +16.6KB | +6.9KB | +1.1KB | +4.7KB | | net8.0 | 9.5KB | 126.8KB | +117.3KB | +16.5KB | +811bytes | +1.6KB | +4.2KB | @@ -1365,6 +1365,11 @@ The class `Polyfill` includes the following extension methods: * `bool IsMatch(ReadOnlySpan, string)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.text.regularexpressions.regex.ismatch?view=net-11.0#system-text-regularexpressions-regex-ismatch(system-readonlyspan((system-char))-system-string)) +#### RuntimeFeature + + * `IsMultithreadingSupported` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.runtimefeature.ismultithreadingsupported?view=net-11.0) + + #### SByte * `bool TryFormat(Span, int, ReadOnlySpan, IFormatProvider?)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.sbyte.tryformat?view=net-11.0#system-sbyte-tryformat(system-span((system-byte))-system-int32@-system-readonlyspan((system-char))-system-iformatprovider)) @@ -1441,6 +1446,14 @@ The class `Polyfill` includes the following extension methods: * `bool TryParse(string?, IFormatProvider?, float)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.single.tryparse?view=net-11.0#system-single-tryparse(system-string-system-iformatprovider-system-single@)) +#### Socket + + * `ValueTask ConnectAsync(EndPoint, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.connectasync?view=net-11.0#system-net-sockets-socket-connectasync(system-net-endpoint-system-threading-cancellationtoken)) + * `ValueTask DisconnectAsync(bool, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.disconnectasync?view=net-11.0#system-net-sockets-socket-disconnectasync(system-boolean-system-threading-cancellationtoken)) + * `ValueTask ReceiveFromAsync(Memory, SocketFlags, EndPoint, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.receivefromasync?view=net-11.0#system-net-sockets-socket-receivefromasync(system-memory((system-byte))-system-net-sockets-socketflags-system-net-endpoint-system-threading-cancellationtoken)) + * `ValueTask SendToAsync(ReadOnlyMemory, SocketFlags, EndPoint, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.sendtoasync?view=net-11.0#system-net-sockets-socket-sendtoasync(system-readonlymemory((system-byte))-system-net-sockets-socketflags-system-net-endpoint-system-threading-cancellationtoken)) + + #### SortedList * `TKey GetKeyAtIndex(int)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.sortedlist-2.getkeyatindex?view=net-11.0) @@ -1495,14 +1508,6 @@ The class `Polyfill` includes the following extension methods: * `bool TryPop(T)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.stack-1.trypop?view=net-11.0) -#### Socket - - * `ValueTask ConnectAsync(EndPoint, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.connectasync?view=net-11.0#system-net-sockets-socket-connectasync(system-net-endpoint-system-threading-cancellationtoken)) - * `ValueTask DisconnectAsync(bool, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.disconnectasync?view=net-11.0#system-net-sockets-socket-disconnectasync(system-boolean-system-threading-cancellationtoken)) - * `ValueTask ReceiveFromAsync(Memory, SocketFlags, EndPoint, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.receivefromasync?view=net-11.0#system-net-sockets-socket-receivefromasync(system-memory((system-byte))-system-net-sockets-socketflags-system-net-endpoint-system-threading-cancellationtoken)) - * `ValueTask SendToAsync(ReadOnlyMemory, SocketFlags, EndPoint, CancellationToken)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.sendtoasync?view=net-11.0#system-net-sockets-socket-sendtoasync(system-readonlymemory((system-byte))-system-net-sockets-socketflags-system-net-endpoint-system-threading-cancellationtoken)) - - #### Stopwatch * `TimeSpan GetElapsedTime(long, long)` [reference](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.stopwatch.getelapsedtime?view=net-11.0#system-diagnostics-stopwatch-getelapsedtime(system-int64-system-int64)) @@ -1878,7 +1883,8 @@ The class `Polyfill` includes the following extension methods: #### TaskCompletionSource -#### UnreachableException +#### UnreachableException + ## References diff --git a/src/Consume/Consume.cs b/src/Consume/Consume.cs index 9d43571e..55c2681f 100644 --- a/src/Consume/Consume.cs +++ b/src/Consume/Consume.cs @@ -779,6 +779,13 @@ void Stopwatch_Methods() elapsed = Stopwatch.GetElapsedTime(timestamp, Stopwatch.GetTimestamp()); } +#if NET471_OR_GREATER || NETCOREAPP || NETSTANDARD2_1_OR_GREATER + void RuntimeFeature_Methods() + { + var supported = RuntimeFeature.IsMultithreadingSupported; + } +#endif + void Path_Methods() { var relative = Path.GetRelativePath("/folder1/folder2", "/folder1/folder3"); diff --git a/src/Polyfill/RuntimeFeaturePolyfill.cs b/src/Polyfill/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..be728595 --- /dev/null +++ b/src/Polyfill/RuntimeFeaturePolyfill.cs @@ -0,0 +1,19 @@ +#if !NET11_0_OR_GREATER && (NET471_OR_GREATER || NETCOREAPP || NETSTANDARD2_1_OR_GREATER) + +namespace Polyfills; + +using System.Runtime.CompilerServices; + +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + //Link: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.runtimefeature.ismultithreadingsupported?view=net-11.0 + public static bool IsMultithreadingSupported => true; + } +} + +#endif diff --git a/src/Split/net10.0/RuntimeFeaturePolyfill.cs b/src/Split/net10.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net10.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net471/RuntimeFeaturePolyfill.cs b/src/Split/net471/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net471/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net472/RuntimeFeaturePolyfill.cs b/src/Split/net472/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net472/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net48/RuntimeFeaturePolyfill.cs b/src/Split/net48/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net48/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net481/RuntimeFeaturePolyfill.cs b/src/Split/net481/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net481/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net5.0/RuntimeFeaturePolyfill.cs b/src/Split/net5.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net5.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net6.0/RuntimeFeaturePolyfill.cs b/src/Split/net6.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net6.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net7.0/RuntimeFeaturePolyfill.cs b/src/Split/net7.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net7.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net8.0/RuntimeFeaturePolyfill.cs b/src/Split/net8.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net8.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/net9.0/RuntimeFeaturePolyfill.cs b/src/Split/net9.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/net9.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/netcoreapp2.0/RuntimeFeaturePolyfill.cs b/src/Split/netcoreapp2.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/netcoreapp2.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/netcoreapp2.1/RuntimeFeaturePolyfill.cs b/src/Split/netcoreapp2.1/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/netcoreapp2.1/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/netcoreapp2.2/RuntimeFeaturePolyfill.cs b/src/Split/netcoreapp2.2/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/netcoreapp2.2/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/netcoreapp3.0/RuntimeFeaturePolyfill.cs b/src/Split/netcoreapp3.0/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/netcoreapp3.0/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/netcoreapp3.1/RuntimeFeaturePolyfill.cs b/src/Split/netcoreapp3.1/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/netcoreapp3.1/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Split/netstandard2.1/RuntimeFeaturePolyfill.cs b/src/Split/netstandard2.1/RuntimeFeaturePolyfill.cs new file mode 100644 index 00000000..95140e20 --- /dev/null +++ b/src/Split/netstandard2.1/RuntimeFeaturePolyfill.cs @@ -0,0 +1,14 @@ +// +#pragma warning disable +namespace Polyfills; +using System.Runtime.CompilerServices; +static partial class Polyfill +{ + extension(RuntimeFeature) + { + /// + /// Gets a value that indicates whether the runtime supports multithreading. + /// + public static bool IsMultithreadingSupported => true; + } +} diff --git a/src/Tests/PolyfillTests_RuntimeFeature.cs b/src/Tests/PolyfillTests_RuntimeFeature.cs new file mode 100644 index 00000000..96d3dc92 --- /dev/null +++ b/src/Tests/PolyfillTests_RuntimeFeature.cs @@ -0,0 +1,14 @@ +#if NET471_OR_GREATER || NETCOREAPP || NETSTANDARD2_1_OR_GREATER + +using System.Runtime.CompilerServices; + +partial class PolyfillTests +{ + [Test] + public async Task RuntimeFeatureIsMultithreadingSupported() + { + await Assert.That(RuntimeFeature.IsMultithreadingSupported).IsTrue(); + } +} + +#endif