Skip to content

Commit 80b748f

Browse files
committed
Suppress IL2091 warnings where not needed
1 parent faf1061 commit 80b748f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CommunityToolkit.Mvvm/Messaging/Internals/System/Runtime.CompilerServices/ConditionalWeakTable2{TKey,TValue}.ZeroAlloc.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public bool Remove(TKey key)
8383
}
8484

8585
/// <inheritdoc cref="ConditionalWeakTable{TKey, TValue}.GetValue(TKey, ConditionalWeakTable{TKey, TValue}.CreateValueCallback)"/>
86+
[UnconditionalSuppressMessage(
87+
"ReflectionAnalysis",
88+
"IL2091",
89+
Justification = "ConditionalWeakTable<TKey, TValue> is only referenced to reuse the callback delegate type, but no value is ever created through reflection.")]
8690
public TValue GetValue(TKey key, ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback)
8791
{
8892
return TryGetValue(key, out TValue? existingValue) ?
@@ -96,6 +100,10 @@ public TValue GetValue(TKey key, ConditionalWeakTable<TKey, TValue>.CreateValueC
96100
/// <param name="key">The input key.</param>
97101
/// <param name="createValueCallback">The callback to use to create a new item.</param>
98102
/// <returns>The new <typeparamref name="TValue"/> item to store.</returns>
103+
[UnconditionalSuppressMessage(
104+
"ReflectionAnalysis",
105+
"IL2091",
106+
Justification = "ConditionalWeakTable<TKey, TValue> is only referenced to reuse the callback delegate type, but no value is ever created through reflection.")]
99107
private TValue GetValueLocked(TKey key, ConditionalWeakTable<TKey, TValue>.CreateValueCallback createValueCallback)
100108
{
101109
// If we got here, the key was not in the table. Invoke the callback

0 commit comments

Comments
 (0)