You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Report: Issue with MaterialDesignThemes Version 5.2.0
Environment:
MaterialDesignThemes Version: 5.2.0
WPF: .NET 8.0
OS: Windows 11 Professional 23H2 22631.4751
CPU: Intel(R) Core(TM) i7-14700KF 3.40 GHz
RAM: 32.0 GB
Description
After upgrading to MaterialDesignThemes version 5.2.0 from 5.1.0, the following issues have occurred:
UI Freezing/Blocking: The application experiences a brief UI freezing when auto-scrolling and removing items from the ListBox that uses virtualization.
System.InvalidOperationException: The following exception occurs intermittently when auto-scrolling a ListBox:
System.InvalidOperationException: "Cannot call StartAt when content generation is in progress."
Steps to Reproduce
Upgrade MaterialDesignThemes to version 5.2.0.
Use a ListBox with virtualization enabled (e.g., VirtualizingStackPanel.VirtualizationMode="Recycling").
Bind a collection (such as InstantMessage) to the ItemsSource of the ListBox.
Implement auto-scrolling when new messages are added (e.g., via ScrollIntoView in the ViewModel_OnMessageUpdated method).
Remove items from the ListBox (e.g., by updating the collection).
Experience brief UI freezing and occasional System.InvalidOperationException.
privatevoidViewModel_OnMessageUpdated(object?sender,EventArgse){try{if(_isMsgAutoScroll&&InstantMessageListBox.Items.Count>0){InstantMessageListBox.ScrollIntoView(InstantMessageListBox.Items[^1]);}}catch{// BUG: ListBox virtualization mode + auto-scrolling error: System.InvalidOperationException:“Cannot call StartAt when content generation is in progress.”}}
Expected Behavior
The application should smoothly auto-scroll the ListBox when new items are added, even if items are removed simultaneously, without causing UI freezing or throwing exceptions.
Actual Behavior
UI Freezing/Blocking: The UI experiences brief freezing when auto-scrolling and removing items from the ListBox with virtualization enabled.
Exception: The InvalidOperationException is thrown intermittently with the message: "Cannot call StartAt when content generation is in progress."
Additional Notes
The issue only occurs after upgrading to version 5.2.0.
The problem does not occur in version 5.1.0, which was working fine with the same code and configuration.
Using delay scheduling does not resolve the issue.
Queue Updates Every Second: The queue updates every second, with a maximum of 15 items per cycle. The performance is not an issue, and this points to a potential issue with MaterialDesignThemes, rather than the performance of the application.
Screenshot
Version
5.2.0
The text was updated successfully, but these errors were encountered:
Bug explanation
Bug Report: Issue with MaterialDesignThemes Version 5.2.0
Environment:
Description
After upgrading to MaterialDesignThemes version 5.2.0 from 5.1.0, the following issues have occurred:
ListBox
that uses virtualization.ListBox
:System.InvalidOperationException: "Cannot call StartAt when content generation is in progress."
Steps to Reproduce
ListBox
with virtualization enabled (e.g.,VirtualizingStackPanel.VirtualizationMode="Recycling"
).InstantMessage
) to theItemsSource
of theListBox
.ScrollIntoView
in theViewModel_OnMessageUpdated
method).ListBox
(e.g., by updating the collection).System.InvalidOperationException
.Code Example
Expected Behavior
The application should smoothly auto-scroll the
ListBox
when new items are added, even if items are removed simultaneously, without causing UI freezing or throwing exceptions.Actual Behavior
Additional Notes
MaterialDesign2
resource fromListBox.Resources
, the issue disappears, Remove the following code:Screenshot
Version
5.2.0
The text was updated successfully, but these errors were encountered: