Skip to content

Commit 48157f0

Browse files
committed
Added missing nullability annotations
1 parent 7351c53 commit 48157f0

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Microsoft.Toolkit.Mvvm/ComponentModel/ObservableValidator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ IEnumerable<ValidationResult> GetAllErrors()
371371
}
372372

373373
// Property-level errors, if any
374-
if (this.errors.TryGetValue(propertyName!, out List<ValidationResult> errors))
374+
if (this.errors.TryGetValue(propertyName!, out List<ValidationResult>? errors))
375375
{
376376
return errors;
377377
}

Microsoft.Toolkit.Mvvm/Messaging/WeakReferenceMessenger.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public bool IsRegistered<TMessage, TToken>(object recipient, TToken token)
6767
return
6868
this.recipientsMap.TryGetValue(type2, out RecipientsTable? table) &&
6969
table!.TryGetValue(recipient, out IDictionarySlim? mapping) &&
70-
Unsafe.As<DictionarySlim<TToken, object>>(mapping).ContainsKey(token);
70+
Unsafe.As<DictionarySlim<TToken, object>>(mapping)!.ContainsKey(token);
7171
}
7272
}
7373

@@ -133,9 +133,9 @@ public void UnregisterAll<TToken>(object recipient, TToken token)
133133
while (enumerator.MoveNext())
134134
{
135135
if (enumerator.Key.TToken == typeof(TToken) &&
136-
enumerator.Value.TryGetValue(recipient, out IDictionarySlim mapping))
136+
enumerator.Value.TryGetValue(recipient, out IDictionarySlim? mapping))
137137
{
138-
Unsafe.As<DictionarySlim<TToken, object>>(mapping).TryRemove(token, out _);
138+
Unsafe.As<DictionarySlim<TToken, object>>(mapping)!.TryRemove(token, out _);
139139
}
140140
}
141141
}
@@ -156,9 +156,9 @@ public void Unregister<TMessage, TToken>(object recipient, TToken token)
156156
while (enumerator.MoveNext())
157157
{
158158
if (enumerator.Key.Equals(type2) &&
159-
enumerator.Value.TryGetValue(recipient, out IDictionarySlim mapping))
159+
enumerator.Value.TryGetValue(recipient, out IDictionarySlim? mapping))
160160
{
161-
Unsafe.As<DictionarySlim<TToken, object>>(mapping).TryRemove(token, out _);
161+
Unsafe.As<DictionarySlim<TToken, object>>(mapping)!.TryRemove(token, out _);
162162
}
163163
}
164164
}
@@ -311,7 +311,7 @@ internal sealed class ConditionalWeakTable<TKey, TValue>
311311
private readonly LinkedList<WeakReference<TKey>> keys = new();
312312

313313
/// <inheritdoc cref="System.Runtime.CompilerServices.ConditionalWeakTable{TKey,TValue}.TryGetValue"/>
314-
public bool TryGetValue(TKey key, out TValue value)
314+
public bool TryGetValue(TKey key, out TValue? value)
315315
{
316316
return this.table.TryGetValue(key, out value);
317317
}

0 commit comments

Comments
 (0)