Skip to content

Remove HashSet allocation in majority cases #1820

Remove HashSet allocation in majority cases

Remove HashSet allocation in majority cases #1820

GitHub Actions / Test Results (Linux, SingleThread, Release) failed Oct 31, 2024 in 1s

Test Results (Linux, SingleThread, Release) ❌

Tests failed

❌ TestResults-Linux-SingleThread-Release.trx

3228 tests were completed in 159s with 3145 passed, 3 failed and 80 skipped.

Test suite Passed Failed Skipped Time
osu.Framework.Tests.Bindables.BindableListTest 118✔️ 1❌ 43ms
osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown 28✔️ 2❌ 358ms

❌ osu.Framework.Tests.Bindables.BindableListTest

✔️ TestAddBranchingBinds
✔️ TestAddRangeAddsItemsToEnumerator
✔️ TestAddRangeBranchingBinds
✔️ TestAddRangeEnumeratesOnlyOnce
✔️ TestAddRangeNotifiesBoundLists
✔️ TestAddWithDisabledListThrowsInvalidOperationException("")
✔️ TestAddWithDisabledListThrowsInvalidOperationException("a random string")
✔️ TestAddWithDisabledListThrowsInvalidOperationException(null)
✔️ TestAddWithListContainingItemsDoesNotOverrideItems("")
✔️ TestAddWithListContainingItemsDoesNotOverrideItems("a random string")
✔️ TestAddWithListContainingItemsDoesNotOverrideItems(null)
✔️ TestAddWithStringAddsStringToEnumerator("")
✔️ TestAddWithStringAddsStringToEnumerator("a random string")
✔️ TestAddWithStringAddsStringToEnumerator(null)
✔️ TestAddWithStringNotifiesBoundList("")
✔️ TestAddWithStringNotifiesBoundList("a random string")
✔️ TestAddWithStringNotifiesBoundList(null)
✔️ TestAddWithStringNotifiesBoundLists("")
✔️ TestAddWithStringNotifiesBoundLists("a random string")
✔️ TestAddWithStringNotifiesBoundLists(null)
✔️ TestAddWithStringNotifiesMultipleSubscribers("")
✔️ TestAddWithStringNotifiesMultipleSubscribers("a random string")
✔️ TestAddWithStringNotifiesMultipleSubscribers(null)
✔️ TestAddWithStringNotifiesMultipleSubscribersOnlyAfterTheAdd("")
✔️ TestAddWithStringNotifiesMultipleSubscribersOnlyAfterTheAdd("a random string")
✔️ TestAddWithStringNotifiesMultipleSubscribersOnlyAfterTheAdd(null)
✔️ TestAddWithStringNotifiesSubscriber("")
✔️ TestAddWithStringNotifiesSubscriber("a random string")
✔️ TestAddWithStringNotifiesSubscriber(null)
✔️ TestAddWithStringNotifiesSubscriberOnce("")
✔️ TestAddWithStringNotifiesSubscriberOnce("a random string")
✔️ TestAddWithStringNotifiesSubscriberOnce(null)
✔️ TestBindCollectionChangedEventsRanIfBoundToDifferentList
✔️ TestBindCollectionChangedNotRunIfBoundToSequenceEqualList
✔️ TestBindCollectionChangedNotRunIfParsingSequenceEqualEnumerable
✔️ TestBindCollectionChangedWithoutRunningImmediately
✔️ TestBindCollectionChangedWithRunImmediately
✔️ TestBindToAlreadyBound
✔️ TestBindViaBindTarget
✔️ TestBoundCopyWithAdd
✔️ TestClear
✔️ TestClearDoesNotNotifyBoundBindablesBeforeClear
✔️ TestClearDoesNotNotifySubscriberBeforeClear
✔️ TestClearNotifiesBoundBindable
✔️ TestClearNotifiesBoundBindables
✔️ TestClearNotifiesSubscriber
✔️ TestClearNotifiesSubscribers
✔️ TestClearUpdatesCountProperty
✔️ TestClearWithDisabledListThrowsInvalidOperationException
✔️ TestClearWithEmptyDisabledListThrowsInvalidOperationException
✔️ TestConstructorDoesNotAddItemsByDefault
✔️ TestConstructorWithItemsAddsItemsInternally
✔️ TestCopyTo
✔️ TestDescriptionWhenSetReturnsSetValue
✔️ TestDisabledNotifiesBoundLists
✔️ TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber
✔️ TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers
✔️ TestDisabledWhenSetToTrueNotifiesSubscriber
✔️ TestDisabledWhenSetToTrueNotifiesSubscribers
✔️ TestGetEnumeratorDoesNotReturnNull
✔️ TestGetEnumeratorWhenCopyConstructorIsUsedDoesNotReturnTheEnumeratorOfTheInputtedEnumerator
✔️ TestGetRetrievesObjectAtIndex
✔️ TestGetWhileDisabledDoesNotThrowInvalidOperationException
✔️ TestInsertBranchingBinds
✔️ TestInsertInsertsItemAtIndex
✔️ TestInsertInsertsItemAtIndexInBoundList
✔️ TestInsertNotifiesBoundLists
✔️ TestInsertNotifiesSubscribers
✔️ TestMoveMovesTheItem
✔️ TestMoveNotifiesBoundList
✔️ TestMoveNotifiesBoundLists
✔️ TestMoveNotifiesBoundListSubscription
✔️ TestMoveNotifiesBoundListSubscriptions
✔️ TestMoveNotifiesSubscriber
✔️ TestMoveNotifiesSubscribers
✔️ TestMoveRangeBranchingBinds
✔️ TestMoveWithDisabledListThrowsInvalidOperationException
✔️ TestParseWithArray
✔️ TestParseWithDisabledListThrowsInvalidOperationException
✔️ TestParseWithInvalidArgumentTypesThrowsArgumentException
✔️ TestParseWithItemsNotifiesAddRangeAndClearSubscribers
✔️ TestParseWithNullClearsList
✔️ TestParseWithNullNotifiesClearSubscribers
✔️ TestRemoveAllNoopDoesntNotifySubscibers
✔️ TestRemoveAllNotifiesBoundLists
✔️ TestRemoveAllNotifiesSubscribers
✔️ TestRemoveAllRemovesMatchingElements
✔️ TestRemoveAtBranchingBinds
✔️ TestRemoveAtNotifiesBoundLists
✔️ TestRemoveAtNotifiesSubscribers
✔️ TestRemoveAtRemovesItemAtIndex
✔️ TestRemoveAtWithDisabledListThrowsInvalidOperationException
✔️ TestRemoveDoesNotNotifySubscribersBeforeItemIsRemoved
✔️ TestRemoveDoesntNotifySubscribersOnNoOp
✔️ TestRemoveNotifiesBoundList
✔️ TestRemoveNotifiesBoundLists
✔️ TestRemoveNotifiesBoundListSubscription
✔️ TestRemoveNotifiesBoundListSubscriptions
✔️ TestRemoveNotifiesSubscriber
✔️ TestRemoveNotifiesSubscribers
✔️ TestRemoveNotifiesSubscriberWithCorrectReference
✔️ TestRemoveRangeDoesNotNotifyBoundListsWhenCountIsZero
✔️ TestRemoveRangeNotifiesBoundLists
✔️ TestRemoveRangeNotifiesSubscribers
✔️ TestRemoveRangeRemovesRange(0,0,0)
✔️ TestRemoveRangeRemovesRange(1,0,1)
✔️ TestRemoveRangeRemovesRange(10,0,0)
✔️ TestRemoveRangeRemovesRange(10,0,9)
✔️ TestRemoveRangeRemovesRange(1000,999,1)
✔️ TestRemoveRangeRemovesRange(3,1,1)
✔️ TestRemoveWhenListIsDisabledThrowsInvalidOperationException
✔️ TestRemoveWithAnItemThatIsInTheListReturnsTrue
✔️ TestRemoveWithAnItemThatIsNotInTheListReturnsFalse
✔️ TestRemoveWithDisabledListThrowsInvalidOperationException
❌ TestReplaceRangeNotifiesBoundLists
	  Expected: equivalent to < "A", "B" >
	  But was:  < < "A", "B" > >
	  Missing (2): < "A", "B" >
	  Extra (1): < < "A", "B" > >
	
✔️ TestSetMutatesObjectAtIndex
✔️ TestSetNotifiesBoundLists
✔️ TestSetNotifiesSubscribers
✔️ TestSetWhileDisabledThrowsInvalidOperationException

❌ osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown

✔️ TestAddItemBeforeDropdownLoad
✔️ TestAddItemWhileDropdownIsInReadyState
✔️ TestAlwaysShowSearchBar
✔️ TestBasic
✔️ TestClearItemsInBindableWhileNotPresent
✔️ TestClickingDropdownClosesOthers
✔️ TestConstructor
✔️ TestDisabledCurrent
✔️ TestDoubleClickOnHeader(False)
✔️ TestDoubleClickOnHeader(True)
✔️ TestDropdownHeight
✔️ TestExternalManagement
✔️ TestInvalidCurrent
❌ TestItemReplacementDoesNotAffectScroll
	System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown+TestModel]' to type 'TestModel'.
❌ TestItemSource
	System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown+TestModel]' to type 'TestModel'.
✔️ TestKeyBindingIsolation
✔️ TestKeyboardSelection(False)
✔️ TestKeyboardSelection(True)
✔️ TestMouseFromTouch
✔️ TestNullCurrent
✔️ TestPaddedSearchBar
✔️ TestReleaseFocusAfterSearching
✔️ TestRemoveDropdownOnSelect
✔️ TestReplaceItems
✔️ TestSearching
✔️ TestSelectByCurrent
✔️ TestSelectByUserInteraction
✔️ TestSelectSearchedItem
✔️ TestSetNonExistentItem(False)
✔️ TestSetNonExistentItem(True)

Annotations

Check failure on line 1190 in osu.Framework.Tests/Bindables/BindableListTest.cs

See this annotation in the file changed.

@github-actions github-actions / Test Results (Linux, SingleThread, Release)

osu.Framework.Tests.Bindables.BindableListTest ► TestReplaceRangeNotifiesBoundLists

Failed test found in:
  TestResults-Linux-SingleThread-Release.trx
Error:
    Expected: equivalent to < "A", "B" >
    But was:  < < "A", "B" > >
    Missing (2): < "A", "B" >
    Extra (1): < < "A", "B" > >
  
Raw output
  Expected: equivalent to < "A", "B" >
  But was:  < < "A", "B" > >
  Missing (2): < "A", "B" >
  Extra (1): < < "A", "B" > >

   at osu.Framework.Tests.Bindables.BindableListTest.TestReplaceRangeNotifiesBoundLists() in /home/runner/work/osu-framework/osu-framework/osu.Framework.Tests/Bindables/BindableListTest.cs:line 1190

1)    at osu.Framework.Tests.Bindables.BindableListTest.TestReplaceRangeNotifiesBoundLists() in /home/runner/work/osu-framework/osu-framework/osu.Framework.Tests/Bindables/BindableListTest.cs:line 1190

Check failure on line 373 in osu.Framework/Graphics/UserInterface/Dropdown.cs

See this annotation in the file changed.

@github-actions github-actions / Test Results (Linux, SingleThread, Release)

osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown ► TestItemReplacementDoesNotAffectScroll

Failed test found in:
  TestResults-Linux-SingleThread-Release.trx
Error:
  System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown+TestModel]' to type 'TestModel'.
Raw output
System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown+TestModel]' to type 'TestModel'.
   at System.Linq.Enumerable.CastIterator[TResult](IEnumerable source)+MoveNext()
   at osu.Framework.Graphics.UserInterface.Dropdown`1.collectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Graphics/UserInterface/Dropdown.cs:line 373
   at osu.Framework.Bindables.BindableList`1.replaceRange(Int32 index, Int32 count, ICollection`1 newItems, InstanceTracker& instances) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Bindables/BindableList.cs:line 393
   at osu.Framework.Bindables.BindableList`1.replaceRange(Int32 index, Int32 count, ICollection`1 newItems, InstanceTracker& instances) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Bindables/BindableList.cs:line 385
   at osu.Framework.Bindables.BindableList`1.ReplaceRange(Int32 index, Int32 count, IEnumerable`1 newItems) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Bindables/BindableList.cs:line 362
   at osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown.<>c__DisplayClass13_0.<TestItemReplacementDoesNotAffectScroll>b__6() in /home/runner/work/osu-framework/osu-framework/osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs:line 380
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0() in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/Drawables/Steps/SingleStepButton.cs:line 19
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/Drawables/Steps/StepButton.cs:line 119
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/TestScene.cs:line 235
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/TestSceneTestRunner.cs:line 89
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/TestScene.cs:line 564
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)

Check failure on line 373 in osu.Framework/Graphics/UserInterface/Dropdown.cs

See this annotation in the file changed.

@github-actions github-actions / Test Results (Linux, SingleThread, Release)

osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown ► TestItemSource

Failed test found in:
  TestResults-Linux-SingleThread-Release.trx
Error:
  System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown+TestModel]' to type 'TestModel'.
Raw output
System.InvalidCastException : Unable to cast object of type 'System.Collections.Generic.List`1[osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown+TestModel]' to type 'TestModel'.
   at System.Linq.Enumerable.CastIterator[TResult](IEnumerable source)+MoveNext()
   at osu.Framework.Graphics.UserInterface.Dropdown`1.collectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Graphics/UserInterface/Dropdown.cs:line 373
   at osu.Framework.Bindables.BindableList`1.replaceRange(Int32 index, Int32 count, ICollection`1 newItems, InstanceTracker& instances) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Bindables/BindableList.cs:line 393
   at osu.Framework.Bindables.BindableList`1.replaceRange(Int32 index, Int32 count, ICollection`1 newItems, InstanceTracker& instances) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Bindables/BindableList.cs:line 385
   at osu.Framework.Bindables.BindableList`1.ReplaceRange(Int32 index, Int32 count, IEnumerable`1 newItems) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Bindables/BindableList.cs:line 362
   at osu.Framework.Tests.Visual.UserInterface.TestSceneDropdown.<>c__DisplayClass11_0.<TestItemSource>b__6() in /home/runner/work/osu-framework/osu-framework/osu.Framework.Tests/Visual/UserInterface/TestSceneDropdown.cs:line 286
   at osu.Framework.Testing.Drawables.Steps.SingleStepButton.<.ctor>b__1_0() in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/Drawables/Steps/SingleStepButton.cs:line 19
   at osu.Framework.Testing.Drawables.Steps.StepButton.PerformStep(Boolean userTriggered) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/Drawables/Steps/StepButton.cs:line 119
   at osu.Framework.Testing.TestScene.runNextStep(Action onCompletion, Action`1 onError, Func`2 stopCondition) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/TestScene.cs:line 235
--- End of stack trace from previous location ---
   at osu.Framework.Testing.TestSceneTestRunner.TestRunner.RunTestBlocking(TestScene test) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/TestSceneTestRunner.cs:line 89
   at osu.Framework.Testing.TestScene.UseTestSceneRunnerAttribute.AfterTest(ITest test) in /home/runner/work/osu-framework/osu-framework/osu.Framework/Testing/TestScene.cs:line 564
   at NUnit.Framework.Internal.Commands.TestActionCommand.<>c__DisplayClass0_0.<.ctor>b__1(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeAndAfterTestCommand.<>c__DisplayClass1_0.<Execute>b__1()
   at NUnit.Framework.Internal.Commands.DelegatingTestCommand.RunTestMethodInThreadAbortSafeZone(TestExecutionContext context, Action action)