From 81eec689064ce42d95c06b36793b2d32c55c78b9 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 1 Jun 2026 21:32:16 +1000 Subject: [PATCH 1/8] Update Directory.Packages.props --- src/Directory.Packages.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props index 0f79a9ac..ea86f33a 100644 --- a/src/Directory.Packages.props +++ b/src/Directory.Packages.props @@ -6,7 +6,7 @@ - + @@ -19,6 +19,6 @@ - + \ No newline at end of file From 5ff20e1b405121bc648ed25118c23a7cfa6ff8a3 Mon Sep 17 00:00:00 2001 From: Cynthia MacLeod Date: Tue, 2 Jun 2026 00:12:55 +0100 Subject: [PATCH 2/8] Fix NET 8 CreateVersion7 polyfill RFC 9562/IETF variant bits (#552) Set correct UUID variant bits in uuidBytes array Updated manipulation of the 9th byte in uuidBytes to mask with 0x3F and set the two highest bits to '10', ensuring compliance with the UUID variant specification. --- src/Polyfill/GuidPolyfill.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Polyfill/GuidPolyfill.cs b/src/Polyfill/GuidPolyfill.cs index 23896306..90a389ea 100644 --- a/src/Polyfill/GuidPolyfill.cs +++ b/src/Polyfill/GuidPolyfill.cs @@ -60,6 +60,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) uuidBytes[6] &= 0x0F; uuidBytes[6] += 0x70; + uuidBytes[8] &= 0x3F; + uuidBytes[8] += 0x80; + return new(uuidBytes, true); #else From 5eef3dea650b3e40d6e3a05b3b49d2fdca1c3aba Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 2 Jun 2026 09:35:50 +1000 Subject: [PATCH 3/8] run split --- src/Directory.Build.props | 2 +- src/Split/net8.0/GuidPolyfill.cs | 2 ++ src/Tests/GuidPolyfillTests.cs | 17 +++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index c7a7fb2e..1c1f7693 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;NETSDK1138;NU1901;NU1902;NU1903;CA1822;CA1847;CA1861;NU1510;NU1608;NU1109 - 10.7.1 + 10.7.2 1.0.0 Polyfill true diff --git a/src/Split/net8.0/GuidPolyfill.cs b/src/Split/net8.0/GuidPolyfill.cs index 1faa4df3..1bdce4c7 100644 --- a/src/Split/net8.0/GuidPolyfill.cs +++ b/src/Split/net8.0/GuidPolyfill.cs @@ -28,6 +28,8 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) RandomNumberGenerator.Fill(randomBytes); uuidBytes[6] &= 0x0F; uuidBytes[6] += 0x70; + uuidBytes[8] &= 0x3F; + uuidBytes[8] += 0x80; return new(uuidBytes, true); } #if FeatureMemory diff --git a/src/Tests/GuidPolyfillTests.cs b/src/Tests/GuidPolyfillTests.cs index 17e695be..ee41547c 100644 --- a/src/Tests/GuidPolyfillTests.cs +++ b/src/Tests/GuidPolyfillTests.cs @@ -92,6 +92,23 @@ public async Task CreateVersion7_ReturnsUniqueGuids() await Assert.That(guid1).IsNotEqualTo(guid2); } + [Test] + public async Task CreateVersion7_SetsVersionAndVariantBits() + { + // Run many times: without the variant fix byte 8 is fully random, + // so the variant nibble would pass by luck ~25% of the time. Looping + // makes a missing variant a deterministic failure (0.25^N). + for (var iteration = 0; iteration < 100; iteration++) + { + var text = Guid.CreateVersion7().ToString(); + // RFC 9562: first hex digit of the 3rd group is the version → '7' + await Assert.That(text[14]).IsEqualTo('7'); + // RFC 9562: first hex digit of the 4th group encodes the '10xx' variant → 8, 9, a or b + var variant = text[19]; + await Assert.That(variant is '8' or '9' or 'a' or 'b').IsTrue(); + } + } + [Test] public async Task CreateVersion7_WithTimestamp_ReturnsDeterministicPrefix() { From d83228fe5e6b40322f21ba4226198b054c16f037 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Tue, 2 Jun 2026 10:37:22 +1000 Subject: [PATCH 4/8] Fix CreateVersion7 endianness on pre-net8 frameworks The #else branch (all sub-net8 TFMs) built uuidBytes in RFC 9562 big-endian order but constructed the Guid with new Guid(byte[]), which reads the first three fields as little-endian. This byte-swapped the first three groups in canonical form: the version nibble landed at the wrong position and the timestamp bytes were scrambled, producing non-canonical v7 GUIDs. Reverse the first three fields before construction so the result matches the bigEndian path used on NET8_0_OR_GREATER. Also expand Guid test coverage: - assert CreateVersion7 sets the version (7) and RFC 9562 variant bits - assert CreateVersion7(DateTimeOffset) encodes the timestamp exactly - cover the 2-arg TryParse(ReadOnlySpan, out) overload (valid + invalid) - add a TryParseExact failure case --- src/Polyfill/GuidPolyfill.cs | 7 ++++ src/Split/net461/GuidPolyfill.cs | 3 ++ src/Split/net462/GuidPolyfill.cs | 3 ++ src/Split/net47/GuidPolyfill.cs | 3 ++ src/Split/net471/GuidPolyfill.cs | 3 ++ src/Split/net472/GuidPolyfill.cs | 3 ++ src/Split/net48/GuidPolyfill.cs | 3 ++ src/Split/net481/GuidPolyfill.cs | 3 ++ src/Split/net5.0/GuidPolyfill.cs | 3 ++ src/Split/net6.0/GuidPolyfill.cs | 3 ++ src/Split/net7.0/GuidPolyfill.cs | 3 ++ src/Split/netcoreapp2.0/GuidPolyfill.cs | 3 ++ src/Split/netcoreapp2.1/GuidPolyfill.cs | 3 ++ src/Split/netcoreapp2.2/GuidPolyfill.cs | 3 ++ src/Split/netcoreapp3.0/GuidPolyfill.cs | 3 ++ src/Split/netcoreapp3.1/GuidPolyfill.cs | 3 ++ src/Split/netstandard2.0/GuidPolyfill.cs | 3 ++ src/Split/netstandard2.1/GuidPolyfill.cs | 3 ++ src/Split/uap10.0/GuidPolyfill.cs | 3 ++ src/Tests/GuidPolyfillTests.cs | 42 ++++++++++++++++++++++++ 20 files changed, 103 insertions(+) diff --git a/src/Polyfill/GuidPolyfill.cs b/src/Polyfill/GuidPolyfill.cs index 90a389ea..8225e61a 100644 --- a/src/Polyfill/GuidPolyfill.cs +++ b/src/Polyfill/GuidPolyfill.cs @@ -82,6 +82,13 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + // new Guid(byte[]) reads the first three fields as little-endian, so reverse + // them to preserve the RFC 9562 big-endian layout (matching the bigEndian + // constructor used on NET8_0_OR_GREATER). + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); + return new(uuidBytes); #endif } diff --git a/src/Split/net461/GuidPolyfill.cs b/src/Split/net461/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net461/GuidPolyfill.cs +++ b/src/Split/net461/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net462/GuidPolyfill.cs b/src/Split/net462/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net462/GuidPolyfill.cs +++ b/src/Split/net462/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net47/GuidPolyfill.cs b/src/Split/net47/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net47/GuidPolyfill.cs +++ b/src/Split/net47/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net471/GuidPolyfill.cs b/src/Split/net471/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net471/GuidPolyfill.cs +++ b/src/Split/net471/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net472/GuidPolyfill.cs b/src/Split/net472/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net472/GuidPolyfill.cs +++ b/src/Split/net472/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net48/GuidPolyfill.cs b/src/Split/net48/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net48/GuidPolyfill.cs +++ b/src/Split/net48/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net481/GuidPolyfill.cs b/src/Split/net481/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/net481/GuidPolyfill.cs +++ b/src/Split/net481/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net5.0/GuidPolyfill.cs b/src/Split/net5.0/GuidPolyfill.cs index 59731afa..5e4fbfad 100644 --- a/src/Split/net5.0/GuidPolyfill.cs +++ b/src/Split/net5.0/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net6.0/GuidPolyfill.cs b/src/Split/net6.0/GuidPolyfill.cs index 59731afa..5e4fbfad 100644 --- a/src/Split/net6.0/GuidPolyfill.cs +++ b/src/Split/net6.0/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/net7.0/GuidPolyfill.cs b/src/Split/net7.0/GuidPolyfill.cs index 0c669209..46bba225 100644 --- a/src/Split/net7.0/GuidPolyfill.cs +++ b/src/Split/net7.0/GuidPolyfill.cs @@ -32,6 +32,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netcoreapp2.0/GuidPolyfill.cs b/src/Split/netcoreapp2.0/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/netcoreapp2.0/GuidPolyfill.cs +++ b/src/Split/netcoreapp2.0/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netcoreapp2.1/GuidPolyfill.cs b/src/Split/netcoreapp2.1/GuidPolyfill.cs index 57e596b1..a9dae7e3 100644 --- a/src/Split/netcoreapp2.1/GuidPolyfill.cs +++ b/src/Split/netcoreapp2.1/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netcoreapp2.2/GuidPolyfill.cs b/src/Split/netcoreapp2.2/GuidPolyfill.cs index 57e596b1..a9dae7e3 100644 --- a/src/Split/netcoreapp2.2/GuidPolyfill.cs +++ b/src/Split/netcoreapp2.2/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netcoreapp3.0/GuidPolyfill.cs b/src/Split/netcoreapp3.0/GuidPolyfill.cs index 57e596b1..a9dae7e3 100644 --- a/src/Split/netcoreapp3.0/GuidPolyfill.cs +++ b/src/Split/netcoreapp3.0/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netcoreapp3.1/GuidPolyfill.cs b/src/Split/netcoreapp3.1/GuidPolyfill.cs index 57e596b1..a9dae7e3 100644 --- a/src/Split/netcoreapp3.1/GuidPolyfill.cs +++ b/src/Split/netcoreapp3.1/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netstandard2.0/GuidPolyfill.cs b/src/Split/netstandard2.0/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/netstandard2.0/GuidPolyfill.cs +++ b/src/Split/netstandard2.0/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/netstandard2.1/GuidPolyfill.cs b/src/Split/netstandard2.1/GuidPolyfill.cs index 59731afa..5e4fbfad 100644 --- a/src/Split/netstandard2.1/GuidPolyfill.cs +++ b/src/Split/netstandard2.1/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Split/uap10.0/GuidPolyfill.cs b/src/Split/uap10.0/GuidPolyfill.cs index 9d742e37..fef94002 100644 --- a/src/Split/uap10.0/GuidPolyfill.cs +++ b/src/Split/uap10.0/GuidPolyfill.cs @@ -37,6 +37,9 @@ public static Guid CreateVersion7(DateTimeOffset timestamp) Array.Copy(randomBytes, 0, uuidBytes, 6, 10); uuidBytes[6] = (byte) ((uuidBytes[6] & 0x0F) | 0x70); uuidBytes[8] = (byte) ((uuidBytes[8] & 0x3F) | 0x80); + Array.Reverse(uuidBytes, 0, 4); + Array.Reverse(uuidBytes, 4, 2); + Array.Reverse(uuidBytes, 6, 2); return new(uuidBytes); } #if FeatureMemory diff --git a/src/Tests/GuidPolyfillTests.cs b/src/Tests/GuidPolyfillTests.cs index ee41547c..ffe5dbf5 100644 --- a/src/Tests/GuidPolyfillTests.cs +++ b/src/Tests/GuidPolyfillTests.cs @@ -72,6 +72,25 @@ public async Task TryParse_Span_ReturnsFalse_ForInvalidGuid() await Assert.That(parsed).IsEqualTo(Guid.Empty); } + [Test] + public async Task TryParse_Span_NoProvider_ReturnsTrue_ForValidGuid() + { + var guid = Guid.NewGuid(); + var span = guid.ToString().AsSpan(); + var result = Guid.TryParse(span, out var parsed); + await Assert.That(result).IsTrue(); + await Assert.That(parsed).IsEqualTo(guid); + } + + [Test] + public async Task TryParse_Span_NoProvider_ReturnsFalse_ForInvalidGuid() + { + var span = "invalid".AsSpan(); + var result = Guid.TryParse(span, out var parsed); + await Assert.That(result).IsFalse(); + await Assert.That(parsed).IsEqualTo(Guid.Empty); + } + [Test] public async Task TryParseExact_Span_ReturnsTrue_ForExactFormat() { @@ -82,6 +101,16 @@ public async Task TryParseExact_Span_ReturnsTrue_ForExactFormat() await Assert.That(result).IsTrue(); await Assert.That(parsed).IsEqualTo(guid); } + + [Test] + public async Task TryParseExact_Span_ReturnsFalse_ForInvalidFormat() + { + var span = "invalid".AsSpan(); + var format = "N".AsSpan(); + var result = Guid.TryParseExact(span, format, out var parsed); + await Assert.That(result).IsFalse(); + await Assert.That(parsed).IsEqualTo(Guid.Empty); + } #endif [Test] @@ -109,6 +138,19 @@ public async Task CreateVersion7_SetsVersionAndVariantBits() } } + [Test] + public async Task CreateVersion7_WithTimestamp_EncodesTimestampExactly() + { + var timestamp = DateTimeOffset.FromUnixTimeMilliseconds(1_700_000_000_000); + var guid = Guid.CreateVersion7(timestamp); + + // RFC 9562: the first 48 bits (12 hex digits) are the Unix-ms timestamp, big-endian. + var text = guid.ToString(); + var timeHex = text.Substring(0, 8) + text.Substring(9, 4); + var expected = timestamp.ToUnixTimeMilliseconds().ToString("x12"); + await Assert.That(timeHex).IsEqualTo(expected); + } + [Test] public async Task CreateVersion7_WithTimestamp_ReturnsDeterministicPrefix() { From eebbea4aef4e2bfef0cbe17a0ccf97ceb9ebc81b Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 3 Jun 2026 10:25:10 +1000 Subject: [PATCH 5/8] Add AsyncMethodBuilderAttribute and CompilerLoweringPreserveAttribute (#553) * Add AsyncMethodBuilderAttribute and CompilerLoweringPreserveAttribute * . --- apiCount.include.md | 46 +++---- assemblySize.include.md | 78 +++++------ readme.md | 124 +++++++++--------- src/Consume/Consume.cs | 4 +- src/Consume/ForceAmbiguousReference.cs | 4 + src/Polyfill/AsyncMethodBuilderAttribute.cs | 45 +++++++ .../CompilerLoweringPreserveAttribute.cs | 26 ++++ src/Split/net10.0/TypeForwardeds.cs | 1 + src/Split/net11.0/TypeForwardeds.cs | 1 + .../net461/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../net462/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../net47/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../net471/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../net472/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../net48/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../net481/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ .../uap10.0/AsyncMethodBuilderAttribute.cs | 42 ++++++ .../CompilerLoweringPreserveAttribute.cs | 20 +++ src/Tests/AsyncMethodBuilderAttributeTests.cs | 9 ++ .../CompilerLoweringPreserveAttributeTests.cs | 14 ++ 41 files changed, 1046 insertions(+), 126 deletions(-) create mode 100644 src/Polyfill/AsyncMethodBuilderAttribute.cs create mode 100644 src/Polyfill/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net461/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net461/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net462/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net462/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net47/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net47/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net471/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net471/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net472/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net472/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net48/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net48/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net481/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/net481/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net5.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net6.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net7.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net8.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/net9.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netcoreapp2.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netcoreapp2.1/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netcoreapp2.2/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netcoreapp3.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netcoreapp3.1/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netstandard2.0/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/netstandard2.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/netstandard2.1/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/netstandard2.1/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Split/uap10.0/AsyncMethodBuilderAttribute.cs create mode 100644 src/Split/uap10.0/CompilerLoweringPreserveAttribute.cs create mode 100644 src/Tests/AsyncMethodBuilderAttributeTests.cs create mode 100644 src/Tests/CompilerLoweringPreserveAttributeTests.cs diff --git a/apiCount.include.md b/apiCount.include.md index 13935dfb..9ca1f8c6 100644 --- a/apiCount.include.md +++ b/apiCount.include.md @@ -1,28 +1,28 @@ -**API count: 959** +**API count: 961** ### Per Target Framework | Target | APIs | | -- | -- | -| `net461` | 934 | -| `net462` | 934 | -| `net47` | 933 | -| `net471` | 932 | -| `net472` | 928 | -| `net48` | 928 | -| `net481` | 928 | -| `netstandard2.0` | 930 | -| `netstandard2.1` | 761 | -| `netcoreapp2.0` | 854 | -| `netcoreapp2.1` | 773 | -| `netcoreapp2.2` | 773 | -| `netcoreapp3.0` | 719 | -| `netcoreapp3.1` | 718 | -| `net5.0` | 590 | -| `net6.0` | 495 | -| `net7.0` | 342 | -| `net8.0` | 223 | -| `net9.0` | 147 | -| `net10.0` | 95 | -| `net11.0` | 58 | -| `uap10.0` | 920 | +| `net461` | 936 | +| `net462` | 936 | +| `net47` | 935 | +| `net471` | 934 | +| `net472` | 930 | +| `net48` | 930 | +| `net481` | 930 | +| `netstandard2.0` | 932 | +| `netstandard2.1` | 763 | +| `netcoreapp2.0` | 856 | +| `netcoreapp2.1` | 775 | +| `netcoreapp2.2` | 775 | +| `netcoreapp3.0` | 721 | +| `netcoreapp3.1` | 720 | +| `net5.0` | 592 | +| `net6.0` | 497 | +| `net7.0` | 344 | +| `net8.0` | 225 | +| `net9.0` | 149 | +| `net10.0` | 96 | +| `net11.0` | 59 | +| `uap10.0` | 922 | diff --git a/assemblySize.include.md b/assemblySize.include.md index 31d0edeb..b292bf89 100644 --- a/assemblySize.include.md +++ b/assemblySize.include.md @@ -2,25 +2,25 @@ | | Empty Assembly | With Polyfill | Diff | Ensure | ArgumentExceptions | StringInterpolation | Nullability | |----------------|----------------|---------------|-----------|-----------|--------------------|---------------------|-------------| -| netstandard2.0 | 8.0KB | 326.5KB | +318.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| netstandard2.1 | 8.5KB | 280.0KB | +271.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net461 | 8.5KB | 325.5KB | +317.0KB | +8.5KB | +6.5KB | +9.0KB | +14.0KB | -| net462 | 7.0KB | 329.0KB | +322.0KB | +8.5KB | +6.5KB | +9.0KB | +14.0KB | -| net47 | 7.0KB | 328.5KB | +321.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net471 | 8.5KB | 328.0KB | +319.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | -| net472 | 8.5KB | 326.5KB | +318.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net48 | 8.5KB | 326.5KB | +318.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net481 | 8.5KB | 326.5KB | +318.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netstandard2.0 | 8.0KB | 327.0KB | +319.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netstandard2.1 | 8.5KB | 280.0KB | +271.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | +| net461 | 8.5KB | 325.5KB | +317.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net462 | 7.0KB | 329.0KB | +322.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net47 | 7.0KB | 329.0KB | +322.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net471 | 8.5KB | 328.0KB | +319.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net472 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| net48 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| net481 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | | netcoreapp2.0 | 9.0KB | 303.0KB | +294.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| netcoreapp2.1 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.0KB | +14.0KB | -| netcoreapp2.2 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.0KB | +14.0KB | -| netcoreapp3.0 | 9.5KB | 274.0KB | +264.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | -| netcoreapp3.1 | 9.5KB | 272.5KB | +263.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | -| net5.0 | 9.5KB | 236.0KB | +226.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net6.0 | 10.0KB | 177.0KB | +167.0KB | +10.0KB | +7.0KB | +512bytes | +4.0KB | -| net7.0 | 10.0KB | 139.5KB | +129.5KB | +9.0KB | +5.5KB | +512bytes | +3.5KB | -| net8.0 | 9.5KB | 111.0KB | +101.5KB | +8.0KB | | +512bytes | +3.0KB | -| net9.0 | 9.5KB | 67.0KB | +57.5KB | +9.0KB | | +512bytes | +3.5KB | +| netcoreapp2.1 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.5KB | +14.0KB | +| netcoreapp2.2 | 9.0KB | 283.0KB | +274.0KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| netcoreapp3.0 | 9.5KB | 274.5KB | +265.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | +| netcoreapp3.1 | 9.5KB | 272.5KB | +263.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | +| net5.0 | 9.5KB | 236.0KB | +226.5KB | +9.5KB | +6.5KB | +9.5KB | +14.5KB | +| net6.0 | 10.0KB | 177.0KB | +167.0KB | +10.0KB | +7.5KB | +1.0KB | +4.0KB | +| net7.0 | 10.0KB | 139.5KB | +129.5KB | +9.5KB | +5.5KB | +512bytes | +4.0KB | +| net8.0 | 9.5KB | 111.0KB | +101.5KB | +8.5KB | +512bytes | +512bytes | +3.5KB | +| net9.0 | 9.5KB | 67.5KB | +58.0KB | +8.5KB | | +512bytes | +3.5KB | | net10.0 | 10.0KB | 43.5KB | +33.5KB | +9.0KB | | +512bytes | +3.5KB | | net11.0 | 10.0KB | 20.5KB | +10.5KB | +9.0KB | | +512bytes | +3.5KB | @@ -29,24 +29,24 @@ | | Empty Assembly | With Polyfill | Diff | Ensure | ArgumentExceptions | StringInterpolation | Nullability | |----------------|----------------|---------------|-----------|-----------|--------------------|---------------------|-------------| -| netstandard2.0 | 8.0KB | 474.9KB | +466.9KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netstandard2.1 | 8.5KB | 403.2KB | +394.7KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net461 | 8.5KB | 474.9KB | +466.4KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | -| net462 | 7.0KB | 478.4KB | +471.4KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | -| net47 | 7.0KB | 477.7KB | +470.7KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net471 | 8.5KB | 476.8KB | +468.3KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | -| net472 | 8.5KB | 474.3KB | +465.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net48 | 8.5KB | 474.3KB | +465.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net481 | 8.5KB | 474.3KB | +465.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netcoreapp2.0 | 9.0KB | 441.6KB | +432.6KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netcoreapp2.1 | 9.0KB | 409.9KB | +400.9KB | +16.7KB | +8.7KB | +13.9KB | +19.4KB | -| netcoreapp2.2 | 9.0KB | 409.9KB | +400.9KB | +16.7KB | +8.7KB | +13.9KB | +19.4KB | -| netcoreapp3.0 | 9.5KB | 392.1KB | +382.6KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| netcoreapp3.1 | 9.5KB | 390.6KB | +381.1KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | -| net5.0 | 9.5KB | 335.9KB | +326.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net6.0 | 10.0KB | 256.9KB | +246.9KB | +17.7KB | +8.7KB | +1.1KB | +4.7KB | -| net7.0 | 10.0KB | 200.8KB | +190.8KB | +16.6KB | +6.9KB | +1.1KB | +4.2KB | -| net8.0 | 9.5KB | 157.1KB | +147.6KB | +15.5KB | +299bytes | +1.1KB | +3.7KB | -| net9.0 | 9.5KB | 92.7KB | +83.2KB | +16.5KB | | +1.1KB | +4.2KB | -| net10.0 | 10.0KB | 60.7KB | +50.7KB | +16.5KB | | +1.1KB | +4.2KB | -| net11.0 | 10.0KB | 30.3KB | +20.3KB | +16.5KB | | +1.1KB | +4.2KB | +| netstandard2.0 | 8.0KB | 476.3KB | +468.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netstandard2.1 | 8.5KB | 404.1KB | +395.6KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net461 | 8.5KB | 475.8KB | +467.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net462 | 7.0KB | 479.3KB | +472.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net47 | 7.0KB | 479.1KB | +472.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net471 | 8.5KB | 477.7KB | +469.2KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net472 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| net48 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| net481 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp2.0 | 9.0KB | 442.5KB | +433.5KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netcoreapp2.1 | 9.0KB | 410.8KB | +401.8KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | +| netcoreapp2.2 | 9.0KB | 411.3KB | +402.3KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp3.0 | 9.5KB | 393.5KB | +384.0KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp3.1 | 9.5KB | 391.5KB | +382.0KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net5.0 | 9.5KB | 336.8KB | +327.3KB | +17.2KB | +8.2KB | +14.4KB | +19.9KB | +| net6.0 | 10.0KB | 257.8KB | +247.8KB | +17.7KB | +9.2KB | +1.6KB | +4.7KB | +| net7.0 | 10.0KB | 201.8KB | +191.8KB | +17.1KB | +6.9KB | +1.1KB | +4.7KB | +| net8.0 | 9.5KB | 158.0KB | +148.5KB | +16.0KB | +811bytes | +1.1KB | +4.2KB | +| net9.0 | 9.5KB | 94.1KB | +84.6KB | +16.0KB | | +1.1KB | +4.2KB | +| net10.0 | 10.0KB | 61.2KB | +51.2KB | +16.5KB | | +1.1KB | +4.2KB | +| net11.0 | 10.0KB | 30.8KB | +20.8KB | +16.5KB | | +1.1KB | +4.2KB | diff --git a/readme.md b/readme.md index 3fa669b1..75ab58b9 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: 959** +**API count: 961** ### Per Target Framework | Target | APIs | | -- | -- | -| `net461` | 934 | -| `net462` | 934 | -| `net47` | 933 | -| `net471` | 932 | -| `net472` | 928 | -| `net48` | 928 | -| `net481` | 928 | -| `netstandard2.0` | 930 | -| `netstandard2.1` | 761 | -| `netcoreapp2.0` | 854 | -| `netcoreapp2.1` | 773 | -| `netcoreapp2.2` | 773 | -| `netcoreapp3.0` | 719 | -| `netcoreapp3.1` | 718 | -| `net5.0` | 590 | -| `net6.0` | 495 | -| `net7.0` | 342 | -| `net8.0` | 223 | -| `net9.0` | 147 | -| `net10.0` | 95 | -| `net11.0` | 58 | -| `uap10.0` | 920 | +| `net461` | 936 | +| `net462` | 936 | +| `net47` | 935 | +| `net471` | 934 | +| `net472` | 930 | +| `net48` | 930 | +| `net481` | 930 | +| `netstandard2.0` | 932 | +| `netstandard2.1` | 763 | +| `netcoreapp2.0` | 856 | +| `netcoreapp2.1` | 775 | +| `netcoreapp2.2` | 775 | +| `netcoreapp3.0` | 721 | +| `netcoreapp3.1` | 720 | +| `net5.0` | 592 | +| `net6.0` | 497 | +| `net7.0` | 344 | +| `net8.0` | 225 | +| `net9.0` | 149 | +| `net10.0` | 96 | +| `net11.0` | 59 | +| `uap10.0` | 922 | @@ -96,25 +96,25 @@ 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 | 326.5KB | +318.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| netstandard2.1 | 8.5KB | 280.0KB | +271.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net461 | 8.5KB | 325.5KB | +317.0KB | +8.5KB | +6.5KB | +9.0KB | +14.0KB | -| net462 | 7.0KB | 329.0KB | +322.0KB | +8.5KB | +6.5KB | +9.0KB | +14.0KB | -| net47 | 7.0KB | 328.5KB | +321.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net471 | 8.5KB | 328.0KB | +319.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | -| net472 | 8.5KB | 326.5KB | +318.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net48 | 8.5KB | 326.5KB | +318.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net481 | 8.5KB | 326.5KB | +318.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netstandard2.0 | 8.0KB | 327.0KB | +319.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| netstandard2.1 | 8.5KB | 280.0KB | +271.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | +| net461 | 8.5KB | 325.5KB | +317.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net462 | 7.0KB | 329.0KB | +322.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net47 | 7.0KB | 329.0KB | +322.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net471 | 8.5KB | 328.0KB | +319.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | +| net472 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| net48 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| net481 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | | netcoreapp2.0 | 9.0KB | 303.0KB | +294.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| netcoreapp2.1 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.0KB | +14.0KB | -| netcoreapp2.2 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.0KB | +14.0KB | -| netcoreapp3.0 | 9.5KB | 274.0KB | +264.5KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | -| netcoreapp3.1 | 9.5KB | 272.5KB | +263.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | -| net5.0 | 9.5KB | 236.0KB | +226.5KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | -| net6.0 | 10.0KB | 177.0KB | +167.0KB | +10.0KB | +7.0KB | +512bytes | +4.0KB | -| net7.0 | 10.0KB | 139.5KB | +129.5KB | +9.0KB | +5.5KB | +512bytes | +3.5KB | -| net8.0 | 9.5KB | 111.0KB | +101.5KB | +8.0KB | | +512bytes | +3.0KB | -| net9.0 | 9.5KB | 67.0KB | +57.5KB | +9.0KB | | +512bytes | +3.5KB | +| netcoreapp2.1 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.5KB | +14.0KB | +| netcoreapp2.2 | 9.0KB | 283.0KB | +274.0KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| netcoreapp3.0 | 9.5KB | 274.5KB | +265.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | +| netcoreapp3.1 | 9.5KB | 272.5KB | +263.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | +| net5.0 | 9.5KB | 236.0KB | +226.5KB | +9.5KB | +6.5KB | +9.5KB | +14.5KB | +| net6.0 | 10.0KB | 177.0KB | +167.0KB | +10.0KB | +7.5KB | +1.0KB | +4.0KB | +| net7.0 | 10.0KB | 139.5KB | +129.5KB | +9.5KB | +5.5KB | +512bytes | +4.0KB | +| net8.0 | 9.5KB | 111.0KB | +101.5KB | +8.5KB | +512bytes | +512bytes | +3.5KB | +| net9.0 | 9.5KB | 67.5KB | +58.0KB | +8.5KB | | +512bytes | +3.5KB | | net10.0 | 10.0KB | 43.5KB | +33.5KB | +9.0KB | | +512bytes | +3.5KB | | net11.0 | 10.0KB | 20.5KB | +10.5KB | +9.0KB | | +512bytes | +3.5KB | @@ -123,27 +123,27 @@ 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 | 474.9KB | +466.9KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netstandard2.1 | 8.5KB | 403.2KB | +394.7KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net461 | 8.5KB | 474.9KB | +466.4KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | -| net462 | 7.0KB | 478.4KB | +471.4KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | -| net47 | 7.0KB | 477.7KB | +470.7KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net471 | 8.5KB | 476.8KB | +468.3KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | -| net472 | 8.5KB | 474.3KB | +465.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net48 | 8.5KB | 474.3KB | +465.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net481 | 8.5KB | 474.3KB | +465.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netcoreapp2.0 | 9.0KB | 441.6KB | +432.6KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netcoreapp2.1 | 9.0KB | 409.9KB | +400.9KB | +16.7KB | +8.7KB | +13.9KB | +19.4KB | -| netcoreapp2.2 | 9.0KB | 409.9KB | +400.9KB | +16.7KB | +8.7KB | +13.9KB | +19.4KB | -| netcoreapp3.0 | 9.5KB | 392.1KB | +382.6KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| netcoreapp3.1 | 9.5KB | 390.6KB | +381.1KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | -| net5.0 | 9.5KB | 335.9KB | +326.4KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net6.0 | 10.0KB | 256.9KB | +246.9KB | +17.7KB | +8.7KB | +1.1KB | +4.7KB | -| net7.0 | 10.0KB | 200.8KB | +190.8KB | +16.6KB | +6.9KB | +1.1KB | +4.2KB | -| net8.0 | 9.5KB | 157.1KB | +147.6KB | +15.5KB | +299bytes | +1.1KB | +3.7KB | -| net9.0 | 9.5KB | 92.7KB | +83.2KB | +16.5KB | | +1.1KB | +4.2KB | -| net10.0 | 10.0KB | 60.7KB | +50.7KB | +16.5KB | | +1.1KB | +4.2KB | -| net11.0 | 10.0KB | 30.3KB | +20.3KB | +16.5KB | | +1.1KB | +4.2KB | +| netstandard2.0 | 8.0KB | 476.3KB | +468.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netstandard2.1 | 8.5KB | 404.1KB | +395.6KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net461 | 8.5KB | 475.8KB | +467.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net462 | 7.0KB | 479.3KB | +472.3KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net47 | 7.0KB | 479.1KB | +472.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net471 | 8.5KB | 477.7KB | +469.2KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| net472 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| net48 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| net481 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp2.0 | 9.0KB | 442.5KB | +433.5KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netcoreapp2.1 | 9.0KB | 410.8KB | +401.8KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | +| netcoreapp2.2 | 9.0KB | 411.3KB | +402.3KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp3.0 | 9.5KB | 393.5KB | +384.0KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp3.1 | 9.5KB | 391.5KB | +382.0KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net5.0 | 9.5KB | 336.8KB | +327.3KB | +17.2KB | +8.2KB | +14.4KB | +19.9KB | +| net6.0 | 10.0KB | 257.8KB | +247.8KB | +17.7KB | +9.2KB | +1.6KB | +4.7KB | +| net7.0 | 10.0KB | 201.8KB | +191.8KB | +17.1KB | +6.9KB | +1.1KB | +4.7KB | +| net8.0 | 9.5KB | 158.0KB | +148.5KB | +16.0KB | +811bytes | +1.1KB | +4.2KB | +| net9.0 | 9.5KB | 94.1KB | +84.6KB | +16.0KB | | +1.1KB | +4.2KB | +| net10.0 | 10.0KB | 61.2KB | +51.2KB | +16.5KB | | +1.1KB | +4.2KB | +| net11.0 | 10.0KB | 30.8KB | +20.8KB | +16.5KB | | +1.1KB | +4.2KB | diff --git a/src/Consume/Consume.cs b/src/Consume/Consume.cs index 356a32f0..317e5706 100644 --- a/src/Consume/Consume.cs +++ b/src/Consume/Consume.cs @@ -106,8 +106,8 @@ class Consume #if FeatureMemory type = typeof(CollectionBuilderAttribute); #endif - //TODO: - //type = typeof(AsyncMethodBuilderAttribute); + type = typeof(AsyncMethodBuilderAttribute); + type = typeof(CompilerLoweringPreserveAttribute); #if !NET6_0 && !NET5_0 type = typeof(ObsoletedOSPlatformAttribute); type = typeof(SupportedOSPlatformGuardAttribute); diff --git a/src/Consume/ForceAmbiguousReference.cs b/src/Consume/ForceAmbiguousReference.cs index 7071ef8c..5a48b5a5 100644 --- a/src/Consume/ForceAmbiguousReference.cs +++ b/src/Consume/ForceAmbiguousReference.cs @@ -30,6 +30,10 @@ public sealed class OverloadResolutionPriorityAttribute; public sealed class ParamCollectionAttribute; +public sealed class AsyncMethodBuilderAttribute; + +public sealed class CompilerLoweringPreserveAttribute; + public sealed class DisableRuntimeMarshallingAttribute; public sealed class AllowNullAttribute; diff --git a/src/Polyfill/AsyncMethodBuilderAttribute.cs b/src/Polyfill/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..338d51b0 --- /dev/null +++ b/src/Polyfill/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,45 @@ +#if !FeatureValueTask && !NETCOREAPP + +namespace System.Runtime.CompilerServices; + +using Diagnostics; +using Diagnostics.CodeAnalysis; + +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +//Link: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.asyncmethodbuilderattribute?view=net-11.0 +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Polyfill/CompilerLoweringPreserveAttribute.cs b/src/Polyfill/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..ca40d347 --- /dev/null +++ b/src/Polyfill/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,26 @@ +#if !NET10_0_OR_GREATER + +namespace System.Runtime.CompilerServices; + +using Diagnostics; +using Diagnostics.CodeAnalysis; + +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +//Link: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.compilerloweringpreserveattribute?view=net-11.0 +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; +#else +[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.CompilerServices.CompilerLoweringPreserveAttribute))] +#endif diff --git a/src/Split/net10.0/TypeForwardeds.cs b/src/Split/net10.0/TypeForwardeds.cs index dc347bc9..b95ad748 100644 --- a/src/Split/net10.0/TypeForwardeds.cs +++ b/src/Split/net10.0/TypeForwardeds.cs @@ -6,6 +6,7 @@ [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.CollectionBuilderAttribute))] [assembly: TypeForwardedTo(typeof(System.Runtime.InteropServices.CollectionsMarshal))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute))] +[assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.CompilerLoweringPreserveAttribute))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.ConfigureAwaitOptions))] [assembly: TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute))] [assembly: TypeForwardedTo(typeof(System.Diagnostics.DebuggerDisableUserUnhandledExceptionsAttribute))] diff --git a/src/Split/net11.0/TypeForwardeds.cs b/src/Split/net11.0/TypeForwardeds.cs index 296cf844..03ee3eb9 100644 --- a/src/Split/net11.0/TypeForwardeds.cs +++ b/src/Split/net11.0/TypeForwardeds.cs @@ -6,6 +6,7 @@ [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.CollectionBuilderAttribute))] [assembly: TypeForwardedTo(typeof(System.Runtime.InteropServices.CollectionsMarshal))] [assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute))] +[assembly: TypeForwardedTo(typeof(System.Runtime.CompilerServices.CompilerLoweringPreserveAttribute))] [assembly: TypeForwardedTo(typeof(System.Threading.Tasks.ConfigureAwaitOptions))] [assembly: TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.ConstantExpectedAttribute))] [assembly: TypeForwardedTo(typeof(System.Diagnostics.DebuggerDisableUserUnhandledExceptionsAttribute))] diff --git a/src/Split/net461/AsyncMethodBuilderAttribute.cs b/src/Split/net461/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net461/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net461/CompilerLoweringPreserveAttribute.cs b/src/Split/net461/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net461/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net462/AsyncMethodBuilderAttribute.cs b/src/Split/net462/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net462/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net462/CompilerLoweringPreserveAttribute.cs b/src/Split/net462/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net462/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net47/AsyncMethodBuilderAttribute.cs b/src/Split/net47/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net47/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net47/CompilerLoweringPreserveAttribute.cs b/src/Split/net47/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net47/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net471/AsyncMethodBuilderAttribute.cs b/src/Split/net471/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net471/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net471/CompilerLoweringPreserveAttribute.cs b/src/Split/net471/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net471/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net472/AsyncMethodBuilderAttribute.cs b/src/Split/net472/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net472/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net472/CompilerLoweringPreserveAttribute.cs b/src/Split/net472/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net472/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net48/AsyncMethodBuilderAttribute.cs b/src/Split/net48/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net48/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net48/CompilerLoweringPreserveAttribute.cs b/src/Split/net48/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net48/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net481/AsyncMethodBuilderAttribute.cs b/src/Split/net481/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/net481/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/net481/CompilerLoweringPreserveAttribute.cs b/src/Split/net481/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net481/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net5.0/CompilerLoweringPreserveAttribute.cs b/src/Split/net5.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net5.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net6.0/CompilerLoweringPreserveAttribute.cs b/src/Split/net6.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net6.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net7.0/CompilerLoweringPreserveAttribute.cs b/src/Split/net7.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net7.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net8.0/CompilerLoweringPreserveAttribute.cs b/src/Split/net8.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net8.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/net9.0/CompilerLoweringPreserveAttribute.cs b/src/Split/net9.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/net9.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netcoreapp2.0/CompilerLoweringPreserveAttribute.cs b/src/Split/netcoreapp2.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netcoreapp2.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netcoreapp2.1/CompilerLoweringPreserveAttribute.cs b/src/Split/netcoreapp2.1/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netcoreapp2.1/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netcoreapp2.2/CompilerLoweringPreserveAttribute.cs b/src/Split/netcoreapp2.2/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netcoreapp2.2/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netcoreapp3.0/CompilerLoweringPreserveAttribute.cs b/src/Split/netcoreapp3.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netcoreapp3.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netcoreapp3.1/CompilerLoweringPreserveAttribute.cs b/src/Split/netcoreapp3.1/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netcoreapp3.1/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netstandard2.0/AsyncMethodBuilderAttribute.cs b/src/Split/netstandard2.0/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/netstandard2.0/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/netstandard2.0/CompilerLoweringPreserveAttribute.cs b/src/Split/netstandard2.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netstandard2.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/netstandard2.1/AsyncMethodBuilderAttribute.cs b/src/Split/netstandard2.1/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/netstandard2.1/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/netstandard2.1/CompilerLoweringPreserveAttribute.cs b/src/Split/netstandard2.1/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/netstandard2.1/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Split/uap10.0/AsyncMethodBuilderAttribute.cs b/src/Split/uap10.0/AsyncMethodBuilderAttribute.cs new file mode 100644 index 00000000..19e126ca --- /dev/null +++ b/src/Split/uap10.0/AsyncMethodBuilderAttribute.cs @@ -0,0 +1,42 @@ +// +#pragma warning disable +#if !FeatureValueTask +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates the type of the async method builder that should be used by a language compiler to +/// build the attributed async method or to build the attributed type when used as the return type +/// of an async method. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage( + AttributeTargets.Class | + AttributeTargets.Struct | + AttributeTargets.Interface | + AttributeTargets.Delegate | + AttributeTargets.Enum | + AttributeTargets.Method, + Inherited = false, + AllowMultiple = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class AsyncMethodBuilderAttribute : + Attribute +{ + /// + /// Initializes a new instance of the class. + /// + public AsyncMethodBuilderAttribute(Type builderType) => + BuilderType = builderType; + /// + /// Gets the of the associated builder. + /// + public Type BuilderType { get; } +} +#endif diff --git a/src/Split/uap10.0/CompilerLoweringPreserveAttribute.cs b/src/Split/uap10.0/CompilerLoweringPreserveAttribute.cs new file mode 100644 index 00000000..d33d626c --- /dev/null +++ b/src/Split/uap10.0/CompilerLoweringPreserveAttribute.cs @@ -0,0 +1,20 @@ +// +#pragma warning disable +namespace System.Runtime.CompilerServices; +using Diagnostics; +using Diagnostics.CodeAnalysis; +/// +/// Indicates to the compiler that applications of an attribute should be preserved +/// through compiler lowering, flowing down to any compiler-generated symbols. +/// +[ExcludeFromCodeCoverage] +[DebuggerNonUserCode] +[AttributeUsage(AttributeTargets.Class, Inherited = false)] +#if PolyUseEmbeddedAttribute +[global::Microsoft.CodeAnalysis.EmbeddedAttribute] +#endif +#if PolyPublic +public +#endif +sealed class CompilerLoweringPreserveAttribute : + Attribute; diff --git a/src/Tests/AsyncMethodBuilderAttributeTests.cs b/src/Tests/AsyncMethodBuilderAttributeTests.cs new file mode 100644 index 00000000..97a985cb --- /dev/null +++ b/src/Tests/AsyncMethodBuilderAttributeTests.cs @@ -0,0 +1,9 @@ +public class AsyncMethodBuilderAttributeTests +{ + [Test] + public async Task Run() + { + var attribute = new AsyncMethodBuilderAttribute(typeof(string)); + await Assert.That(attribute.BuilderType).IsEqualTo(typeof(string)); + } +} diff --git a/src/Tests/CompilerLoweringPreserveAttributeTests.cs b/src/Tests/CompilerLoweringPreserveAttributeTests.cs new file mode 100644 index 00000000..16ad6800 --- /dev/null +++ b/src/Tests/CompilerLoweringPreserveAttributeTests.cs @@ -0,0 +1,14 @@ +using System.Reflection; + +public class CompilerLoweringPreserveAttributeTests +{ + [Test] + public async Task Run() + { + var attribute = typeof(Decorated).GetCustomAttribute(); + await Assert.That(attribute).IsNotNull(); + } + + [CompilerLoweringPreserve] + class Decorated : Attribute; +} From 622a4d9ce33b353ecccc039bc5edce08376faabe Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Wed, 3 Jun 2026 10:25:52 +1000 Subject: [PATCH 6/8] Update Directory.Build.props --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 1c1f7693..1dcb2d9b 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;NETSDK1138;NU1901;NU1902;NU1903;CA1822;CA1847;CA1861;NU1510;NU1608;NU1109 - 10.7.2 + 10.8.0 1.0.0 Polyfill true From 445ba5021dab7ac2a1873561343f89823afb5a27 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 7 Jun 2026 21:57:19 +1000 Subject: [PATCH 7/8] Update readme.md --- readme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 75ab58b9..0813a5dd 100644 --- a/readme.md +++ b/readme.md @@ -65,7 +65,7 @@ It is recommended that projects that consume Polyfill multi-target all TFMs that ## SDK / LangVersion -This project uses features from the current stable SDK and C# language. As such consuming projects should target those: +This project uses features from the newest stable SDK and C# language. As such consuming projects should target those: ### LangVersion @@ -82,7 +82,7 @@ This project uses features from the current stable SDK and C# language. As such ```json { "sdk": { - "version": "10.0.100", + "version": "10.0.300", "rollForward": "latestFeature" } } From a0607caa303fba01918658896e6b72b8968461fa Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 7 Jun 2026 22:12:01 +1000 Subject: [PATCH 8/8] struct Range: invalid parameter names (#556) --- apiCount.include.md | 24 ++++++------- assemblySize.include.md | 36 ++++++++++---------- src/Consume/Consume.cs | 2 ++ src/Directory.Build.props | 2 +- src/Polyfill/IndexRange/Range.cs | 15 +++++++- src/Split/net461/IndexRange/Range.cs | 12 ++++++- src/Split/net462/IndexRange/Range.cs | 12 ++++++- src/Split/net47/IndexRange/Range.cs | 12 ++++++- src/Split/net471/IndexRange/Range.cs | 12 ++++++- src/Split/net472/IndexRange/Range.cs | 12 ++++++- src/Split/net48/IndexRange/Range.cs | 12 ++++++- src/Split/net481/IndexRange/Range.cs | 12 ++++++- src/Split/netcoreapp2.0/IndexRange/Range.cs | 12 ++++++- src/Split/netcoreapp2.1/IndexRange/Range.cs | 12 ++++++- src/Split/netcoreapp2.2/IndexRange/Range.cs | 12 ++++++- src/Split/netstandard2.0/IndexRange/Range.cs | 12 ++++++- src/Split/uap10.0/IndexRange/Range.cs | 12 ++++++- 17 files changed, 179 insertions(+), 44 deletions(-) diff --git a/apiCount.include.md b/apiCount.include.md index 9ca1f8c6..308fbf4e 100644 --- a/apiCount.include.md +++ b/apiCount.include.md @@ -13,16 +13,16 @@ | `net481` | 930 | | `netstandard2.0` | 932 | | `netstandard2.1` | 763 | -| `netcoreapp2.0` | 856 | -| `netcoreapp2.1` | 775 | -| `netcoreapp2.2` | 775 | -| `netcoreapp3.0` | 721 | -| `netcoreapp3.1` | 720 | -| `net5.0` | 592 | -| `net6.0` | 497 | -| `net7.0` | 344 | -| `net8.0` | 225 | -| `net9.0` | 149 | -| `net10.0` | 96 | -| `net11.0` | 59 | +| `netcoreapp2.0` | 855 | +| `netcoreapp2.1` | 774 | +| `netcoreapp2.2` | 774 | +| `netcoreapp3.0` | 720 | +| `netcoreapp3.1` | 719 | +| `net5.0` | 591 | +| `net6.0` | 496 | +| `net7.0` | 343 | +| `net8.0` | 224 | +| `net9.0` | 148 | +| `net10.0` | 95 | +| `net11.0` | 58 | | `uap10.0` | 922 | diff --git a/assemblySize.include.md b/assemblySize.include.md index b292bf89..69681623 100644 --- a/assemblySize.include.md +++ b/assemblySize.include.md @@ -13,14 +13,14 @@ | net481 | 8.5KB | 327.0KB | +318.5KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | | netcoreapp2.0 | 9.0KB | 303.0KB | +294.0KB | +9.0KB | +6.5KB | +9.0KB | +14.0KB | | netcoreapp2.1 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.5KB | +14.0KB | -| netcoreapp2.2 | 9.0KB | 283.0KB | +274.0KB | +8.5KB | +6.5KB | +9.0KB | +13.5KB | +| netcoreapp2.2 | 9.0KB | 282.5KB | +273.5KB | +9.0KB | +7.0KB | +9.5KB | +14.0KB | | netcoreapp3.0 | 9.5KB | 274.5KB | +265.0KB | +9.0KB | +6.5KB | +9.0KB | +13.5KB | | netcoreapp3.1 | 9.5KB | 272.5KB | +263.0KB | +9.0KB | +6.5KB | +9.5KB | +14.0KB | -| net5.0 | 9.5KB | 236.0KB | +226.5KB | +9.5KB | +6.5KB | +9.5KB | +14.5KB | -| net6.0 | 10.0KB | 177.0KB | +167.0KB | +10.0KB | +7.5KB | +1.0KB | +4.0KB | -| net7.0 | 10.0KB | 139.5KB | +129.5KB | +9.5KB | +5.5KB | +512bytes | +4.0KB | -| net8.0 | 9.5KB | 111.0KB | +101.5KB | +8.5KB | +512bytes | +512bytes | +3.5KB | -| net9.0 | 9.5KB | 67.5KB | +58.0KB | +8.5KB | | +512bytes | +3.5KB | +| net5.0 | 9.5KB | 236.0KB | +226.5KB | +9.0KB | +6.5KB | +9.5KB | +14.5KB | +| net6.0 | 10.0KB | 177.0KB | +167.0KB | +10.0KB | +7.5KB | +512bytes | +4.0KB | +| net7.0 | 10.0KB | 139.5KB | +129.5KB | +9.5KB | +5.5KB | +512bytes | +3.5KB | +| net8.0 | 9.5KB | 111.0KB | +101.5KB | +8.5KB | | +512bytes | +3.5KB | +| net9.0 | 9.5KB | 67.5KB | +58.0KB | +8.5KB | | +512bytes | +3.0KB | | net10.0 | 10.0KB | 43.5KB | +33.5KB | +9.0KB | | +512bytes | +3.5KB | | net11.0 | 10.0KB | 20.5KB | +10.5KB | +9.0KB | | +512bytes | +3.5KB | @@ -38,15 +38,15 @@ | net472 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | | net48 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | | net481 | 8.5KB | 475.7KB | +467.2KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | -| netcoreapp2.0 | 9.0KB | 442.5KB | +433.5KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| netcoreapp2.1 | 9.0KB | 410.8KB | +401.8KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | -| netcoreapp2.2 | 9.0KB | 411.3KB | +402.3KB | +16.2KB | +8.2KB | +13.9KB | +18.9KB | -| netcoreapp3.0 | 9.5KB | 393.5KB | +384.0KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | -| netcoreapp3.1 | 9.5KB | 391.5KB | +382.0KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net5.0 | 9.5KB | 336.8KB | +327.3KB | +17.2KB | +8.2KB | +14.4KB | +19.9KB | -| net6.0 | 10.0KB | 257.8KB | +247.8KB | +17.7KB | +9.2KB | +1.6KB | +4.7KB | -| net7.0 | 10.0KB | 201.8KB | +191.8KB | +17.1KB | +6.9KB | +1.1KB | +4.7KB | -| net8.0 | 9.5KB | 158.0KB | +148.5KB | +16.0KB | +811bytes | +1.1KB | +4.2KB | -| net9.0 | 9.5KB | 94.1KB | +84.6KB | +16.0KB | | +1.1KB | +4.2KB | -| net10.0 | 10.0KB | 61.2KB | +51.2KB | +16.5KB | | +1.1KB | +4.2KB | -| net11.0 | 10.0KB | 30.8KB | +20.8KB | +16.5KB | | +1.1KB | +4.2KB | +| netcoreapp2.0 | 9.0KB | 441.9KB | +432.9KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | +| netcoreapp2.1 | 9.0KB | 410.3KB | +401.3KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | +| netcoreapp2.2 | 9.0KB | 410.3KB | +401.3KB | +16.7KB | +8.7KB | +14.4KB | +19.4KB | +| netcoreapp3.0 | 9.5KB | 393.0KB | +383.5KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | +| netcoreapp3.1 | 9.5KB | 391.0KB | +381.5KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net5.0 | 9.5KB | 336.3KB | +326.8KB | +16.7KB | +8.2KB | +14.4KB | +19.9KB | +| net6.0 | 10.0KB | 257.3KB | +247.3KB | +17.7KB | +9.2KB | +1.1KB | +4.7KB | +| net7.0 | 10.0KB | 201.2KB | +191.2KB | +17.1KB | +6.9KB | +1.1KB | +4.2KB | +| net8.0 | 9.5KB | 157.4KB | +147.9KB | +16.0KB | +299bytes | +1.1KB | +4.2KB | +| net9.0 | 9.5KB | 93.6KB | +84.1KB | +16.0KB | | +1.1KB | +3.7KB | +| net10.0 | 10.0KB | 60.7KB | +50.7KB | +16.5KB | | +1.1KB | +4.2KB | +| net11.0 | 10.0KB | 30.3KB | +20.3KB | +16.5KB | | +1.1KB | +4.2KB | diff --git a/src/Consume/Consume.cs b/src/Consume/Consume.cs index 317e5706..d87d595e 100644 --- a/src/Consume/Consume.cs +++ b/src/Consume/Consume.cs @@ -397,6 +397,8 @@ void Ranges() { var range = "value"[1..]; var index = "value"[^2]; + // named constructor parameters must match the BCL (lowercase start/end) + var namedRange = new Range(start: Index.Start, end: Index.End); //Array not supported due to no RuntimeHelpers.GetSubArray // var subArray = new[] // { diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 1dcb2d9b..bdac1091 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -2,7 +2,7 @@ CS1591;NETSDK1138;NU1901;NU1902;NU1903;CA1822;CA1847;CA1861;NU1510;NU1608;NU1109 - 10.8.0 + 10.8.1 1.0.0 Polyfill true diff --git a/src/Polyfill/IndexRange/Range.cs b/src/Polyfill/IndexRange/Range.cs index 677e32af..0d5fb0f0 100644 --- a/src/Polyfill/IndexRange/Range.cs +++ b/src/Polyfill/IndexRange/Range.cs @@ -16,8 +16,21 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + + /// Represent the exclusive end index of the Range. + public Index End { get; } + + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } + /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net461/IndexRange/Range.cs b/src/Split/net461/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net461/IndexRange/Range.cs +++ b/src/Split/net461/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net462/IndexRange/Range.cs b/src/Split/net462/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net462/IndexRange/Range.cs +++ b/src/Split/net462/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net47/IndexRange/Range.cs b/src/Split/net47/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net47/IndexRange/Range.cs +++ b/src/Split/net47/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net471/IndexRange/Range.cs b/src/Split/net471/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net471/IndexRange/Range.cs +++ b/src/Split/net471/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net472/IndexRange/Range.cs b/src/Split/net472/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net472/IndexRange/Range.cs +++ b/src/Split/net472/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net48/IndexRange/Range.cs b/src/Split/net48/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net48/IndexRange/Range.cs +++ b/src/Split/net48/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/net481/IndexRange/Range.cs b/src/Split/net481/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/net481/IndexRange/Range.cs +++ b/src/Split/net481/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/netcoreapp2.0/IndexRange/Range.cs b/src/Split/netcoreapp2.0/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/netcoreapp2.0/IndexRange/Range.cs +++ b/src/Split/netcoreapp2.0/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/netcoreapp2.1/IndexRange/Range.cs b/src/Split/netcoreapp2.1/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/netcoreapp2.1/IndexRange/Range.cs +++ b/src/Split/netcoreapp2.1/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/netcoreapp2.2/IndexRange/Range.cs b/src/Split/netcoreapp2.2/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/netcoreapp2.2/IndexRange/Range.cs +++ b/src/Split/netcoreapp2.2/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/netstandard2.0/IndexRange/Range.cs b/src/Split/netstandard2.0/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/netstandard2.0/IndexRange/Range.cs +++ b/src/Split/netstandard2.0/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}"; diff --git a/src/Split/uap10.0/IndexRange/Range.cs b/src/Split/uap10.0/IndexRange/Range.cs index 1f5c0591..99b0a8b7 100644 --- a/src/Split/uap10.0/IndexRange/Range.cs +++ b/src/Split/uap10.0/IndexRange/Range.cs @@ -14,8 +14,18 @@ namespace System; #if PolyPublic public #endif -readonly record struct Range(Index Start, Index End) +readonly record struct Range { + /// Represent the inclusive start index of the Range. + public Index Start { get; } + /// Represent the exclusive end index of the Range. + public Index End { get; } + /// Construct a Range object using the start and end indexes. + public Range(Index start, Index end) + { + Start = start; + End = end; + } /// Converts the value of the current Range object to its equivalent string representation. public override string ToString() => $"{Start}..{End}";