Skip to content

Commit 1060fbf

Browse files
authored
Merge branch 'master' into removeObsolete7
2 parents 75da45c + aa2ad66 commit 1060fbf

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

Microsoft.Toolkit/Collections/ObservableGroupedCollectionExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ private static void RemoveItemAtWithLinq<TKey, TValue>(
444444
/// <summary>
445445
/// Throws a new <see cref="InvalidOperationException"/> when a key is not found.
446446
/// </summary>
447-
[MethodImpl(MethodImplOptions.NoInlining)]
448447
private static void ThrowArgumentExceptionForKeyNotFound()
449448
{
450449
throw new InvalidOperationException("The requested key was not present in the collection");

Microsoft.Toolkit/Collections/ReadOnlyObservableGroupedCollection.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@ private void OnSourceCollectionChanged(object sender, NotifyCollectionChangedEve
5252
// reporting the changes one by one. We consider only this case for now.
5353
if (e.OldItems?.Count > 1 || e.NewItems?.Count > 1)
5454
{
55-
Debug.Fail("OldItems and NewItems should contain at most 1 item");
56-
throw new NotSupportedException();
55+
static void ThrowNotSupportedException()
56+
{
57+
throw new NotSupportedException(
58+
"ReadOnlyObservableGroupedCollection<TKey, TValue> doesn't support operations on multiple items at once.\n" +
59+
"If this exception was thrown, it likely means support for batched item updates has been added to the " +
60+
"underlying ObservableCollection<T> type, and this implementation doesn't support that feature yet.\n" +
61+
"Please consider opening an issue in https://aka.ms/windowstoolkit to report this.");
62+
}
63+
64+
ThrowNotSupportedException();
5765
}
5866

5967
var newItem = e.NewItems?.Cast<ObservableGroup<TKey, TValue>>()?.FirstOrDefault();

0 commit comments

Comments
 (0)