From ca8d47e4a1de2ab83e4523d32bfa7958e7b27f4a Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 5 Oct 2026 18:58:45 +1100 Subject: [PATCH 1/2] Annotate TValue on ConditionalWeakTable.Remove polyfill to fix IL2091 ConditionalWeakTable declares TValue with DynamicallyAccessedMembers(PublicParameterlessConstructor). The Remove(key, out value) polyfill did not, so trim analysis reported IL2091 for any consumer that roots its assembly. Root the ConsumeTrimmed assembly so the trimmer analyzes every polyfill, not only the reachable ones. Fixes #615 --- assemblySize.include.md | 16 ++++++++-------- src/ConsumeTrimmed/ConsumeTrimmed.csproj | 2 ++ src/Polyfill/Polyfill_ConditionalWeakTable.cs | 2 +- .../net461/Polyfill_ConditionalWeakTable.cs | 2 +- .../net462/Polyfill_ConditionalWeakTable.cs | 2 +- src/Split/net47/Polyfill_ConditionalWeakTable.cs | 2 +- .../net471/Polyfill_ConditionalWeakTable.cs | 2 +- .../net472/Polyfill_ConditionalWeakTable.cs | 2 +- src/Split/net48/Polyfill_ConditionalWeakTable.cs | 2 +- .../net481/Polyfill_ConditionalWeakTable.cs | 2 +- .../net5.0/Polyfill_ConditionalWeakTable.cs | 2 +- .../net6.0/Polyfill_ConditionalWeakTable.cs | 2 +- .../net7.0/Polyfill_ConditionalWeakTable.cs | 2 +- .../net8.0/Polyfill_ConditionalWeakTable.cs | 2 +- .../net9.0/Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../Polyfill_ConditionalWeakTable.cs | 2 +- .../uap10.0/Polyfill_ConditionalWeakTable.cs | 2 +- 23 files changed, 31 insertions(+), 29 deletions(-) diff --git a/assemblySize.include.md b/assemblySize.include.md index bb77db01..c65725b2 100644 --- a/assemblySize.include.md +++ b/assemblySize.include.md @@ -33,20 +33,20 @@ | netstandard2.1 | 8.5KB | 494.7KB | +486.2KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | net461 | 8.5KB | 568.4KB | +559.9KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | | net462 | 7.0KB | 571.9KB | +564.9KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net47 | 7.0KB | 571.6KB | +564.6KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | +| net47 | 7.0KB | 571.7KB | +564.7KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | | net471 | 8.5KB | 570.3KB | +561.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net472 | 8.5KB | 567.7KB | +559.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net48 | 8.5KB | 567.7KB | +559.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net481 | 8.5KB | 567.7KB | +559.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net472 | 8.5KB | 567.8KB | +559.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net48 | 8.5KB | 567.8KB | +559.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net481 | 8.5KB | 567.8KB | +559.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | | netcoreapp2.0 | 9.0KB | 535.8KB | +526.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | netcoreapp2.1 | 9.0KB | 506.1KB | +497.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | netcoreapp2.2 | 9.0KB | 506.1KB | +497.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | netcoreapp3.0 | 9.5KB | 494.7KB | +485.2KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | | netcoreapp3.1 | 9.5KB | 492.7KB | +483.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net5.0 | 9.5KB | 440.7KB | +431.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net6.0 | 10.0KB | 362.0KB | +352.0KB | +17.2KB | +8.2KB | +1.1KB | +3.7KB | -| net7.0 | 10.0KB | 315.4KB | +305.4KB | +17.1KB | +7.4KB | +1.1KB | +4.2KB | -| net8.0 | 9.5KB | 271.0KB | +261.5KB | +16.0KB | +299bytes | +1.1KB | +3.7KB | +| net5.0 | 9.5KB | 440.8KB | +431.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net6.0 | 10.0KB | 362.1KB | +352.1KB | +17.2KB | +8.2KB | +1.1KB | +3.7KB | +| net7.0 | 10.0KB | 315.5KB | +305.5KB | +17.1KB | +7.4KB | +1.1KB | +4.2KB | +| net8.0 | 9.5KB | 271.1KB | +261.6KB | +16.0KB | +299bytes | +1.1KB | +3.7KB | | net9.0 | 9.5KB | 173.6KB | +164.1KB | +16.0KB | | +1.1KB | +4.2KB | | net10.0 | 10.0KB | 139.1KB | +129.1KB | +16.0KB | | +1.1KB | +4.2KB | | net11.0 | 10.0KB | 30.9KB | +20.9KB | +16.5KB | | +1.1KB | +4.2KB | diff --git a/src/ConsumeTrimmed/ConsumeTrimmed.csproj b/src/ConsumeTrimmed/ConsumeTrimmed.csproj index 864f56e5..6ef6a2e2 100644 --- a/src/ConsumeTrimmed/ConsumeTrimmed.csproj +++ b/src/ConsumeTrimmed/ConsumeTrimmed.csproj @@ -15,6 +15,8 @@ + + diff --git a/src/Polyfill/Polyfill_ConditionalWeakTable.cs b/src/Polyfill/Polyfill_ConditionalWeakTable.cs index 72c235aa..2db5d00b 100644 --- a/src/Polyfill/Polyfill_ConditionalWeakTable.cs +++ b/src/Polyfill/Polyfill_ConditionalWeakTable.cs @@ -12,7 +12,7 @@ static partial class Polyfill /// //Link: https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.conditionalweaktable-2.remove?view=net-11.0#system-runtime-compilerservices-conditionalweaktable-2-remove(-0-1@) //Note: Lookup and removal are not performed under the table lock, so the operation is not atomic with regard to concurrent mutations. - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net461/Polyfill_ConditionalWeakTable.cs b/src/Split/net461/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net461/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net461/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net462/Polyfill_ConditionalWeakTable.cs b/src/Split/net462/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net462/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net462/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net47/Polyfill_ConditionalWeakTable.cs b/src/Split/net47/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net47/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net47/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net471/Polyfill_ConditionalWeakTable.cs b/src/Split/net471/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net471/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net471/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net472/Polyfill_ConditionalWeakTable.cs b/src/Split/net472/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net472/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net472/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net48/Polyfill_ConditionalWeakTable.cs b/src/Split/net48/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net48/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net48/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net481/Polyfill_ConditionalWeakTable.cs b/src/Split/net481/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net481/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net481/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net5.0/Polyfill_ConditionalWeakTable.cs b/src/Split/net5.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net5.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net5.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net6.0/Polyfill_ConditionalWeakTable.cs b/src/Split/net6.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net6.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net6.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net7.0/Polyfill_ConditionalWeakTable.cs b/src/Split/net7.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net7.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net7.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net8.0/Polyfill_ConditionalWeakTable.cs b/src/Split/net8.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net8.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net8.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/net9.0/Polyfill_ConditionalWeakTable.cs b/src/Split/net9.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/net9.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/net9.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netcoreapp2.0/Polyfill_ConditionalWeakTable.cs b/src/Split/netcoreapp2.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netcoreapp2.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netcoreapp2.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netcoreapp2.1/Polyfill_ConditionalWeakTable.cs b/src/Split/netcoreapp2.1/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netcoreapp2.1/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netcoreapp2.1/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netcoreapp2.2/Polyfill_ConditionalWeakTable.cs b/src/Split/netcoreapp2.2/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netcoreapp2.2/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netcoreapp2.2/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netcoreapp3.0/Polyfill_ConditionalWeakTable.cs b/src/Split/netcoreapp3.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netcoreapp3.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netcoreapp3.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netcoreapp3.1/Polyfill_ConditionalWeakTable.cs b/src/Split/netcoreapp3.1/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netcoreapp3.1/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netcoreapp3.1/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netstandard2.0/Polyfill_ConditionalWeakTable.cs b/src/Split/netstandard2.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netstandard2.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netstandard2.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/netstandard2.1/Polyfill_ConditionalWeakTable.cs b/src/Split/netstandard2.1/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/netstandard2.1/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/netstandard2.1/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) diff --git a/src/Split/uap10.0/Polyfill_ConditionalWeakTable.cs b/src/Split/uap10.0/Polyfill_ConditionalWeakTable.cs index d532932e..e5baa4a5 100644 --- a/src/Split/uap10.0/Polyfill_ConditionalWeakTable.cs +++ b/src/Split/uap10.0/Polyfill_ConditionalWeakTable.cs @@ -8,7 +8,7 @@ static partial class Polyfill /// /// Removes a key and its value from the table, and returns the removed value. /// - public static bool Remove( + public static bool Remove( this ConditionalWeakTable target, TKey key, [MaybeNullWhen(false)] out TValue value) From f9c39401697b15c7c6d40ad6fa857938fcedbbc6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Mon, 5 Oct 2026 07:59:26 +0000 Subject: [PATCH 2/2] Docs changes --- readme.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/readme.md b/readme.md index 46f4e7ac..39a5f28e 100644 --- a/readme.md +++ b/readme.md @@ -127,20 +127,20 @@ This project uses features from the newest stable SDK and C# language. As such c | netstandard2.1 | 8.5KB | 494.7KB | +486.2KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | net461 | 8.5KB | 568.4KB | +559.9KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | | net462 | 7.0KB | 571.9KB | +564.9KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net47 | 7.0KB | 571.6KB | +564.6KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | +| net47 | 7.0KB | 571.7KB | +564.7KB | +16.2KB | +8.2KB | +13.9KB | +19.4KB | | net471 | 8.5KB | 570.3KB | +561.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | -| net472 | 8.5KB | 567.7KB | +559.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net48 | 8.5KB | 567.7KB | +559.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net481 | 8.5KB | 567.7KB | +559.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net472 | 8.5KB | 567.8KB | +559.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net48 | 8.5KB | 567.8KB | +559.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net481 | 8.5KB | 567.8KB | +559.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | | netcoreapp2.0 | 9.0KB | 535.8KB | +526.8KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | netcoreapp2.1 | 9.0KB | 506.1KB | +497.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | netcoreapp2.2 | 9.0KB | 506.1KB | +497.1KB | +16.7KB | +8.2KB | +13.9KB | +19.4KB | | netcoreapp3.0 | 9.5KB | 494.7KB | +485.2KB | +16.7KB | +8.2KB | +13.9KB | +18.9KB | | netcoreapp3.1 | 9.5KB | 492.7KB | +483.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net5.0 | 9.5KB | 440.7KB | +431.2KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | -| net6.0 | 10.0KB | 362.0KB | +352.0KB | +17.2KB | +8.2KB | +1.1KB | +3.7KB | -| net7.0 | 10.0KB | 315.4KB | +305.4KB | +17.1KB | +7.4KB | +1.1KB | +4.2KB | -| net8.0 | 9.5KB | 271.0KB | +261.5KB | +16.0KB | +299bytes | +1.1KB | +3.7KB | +| net5.0 | 9.5KB | 440.8KB | +431.3KB | +16.7KB | +8.2KB | +14.4KB | +19.4KB | +| net6.0 | 10.0KB | 362.1KB | +352.1KB | +17.2KB | +8.2KB | +1.1KB | +3.7KB | +| net7.0 | 10.0KB | 315.5KB | +305.5KB | +17.1KB | +7.4KB | +1.1KB | +4.2KB | +| net8.0 | 9.5KB | 271.1KB | +261.6KB | +16.0KB | +299bytes | +1.1KB | +3.7KB | | net9.0 | 9.5KB | 173.6KB | +164.1KB | +16.0KB | | +1.1KB | +4.2KB | | net10.0 | 10.0KB | 139.1KB | +129.1KB | +16.0KB | | +1.1KB | +4.2KB | | net11.0 | 10.0KB | 30.9KB | +20.9KB | +16.5KB | | +1.1KB | +4.2KB |