wpf
wpf copied to clipboard
System.Windows.UncommonField<bool>.SetValue generating garbage
When scrolling a VirtualizingStackPanel, this line of code does lots of boxing of bool values. thus leading to frequent GC.
https://github.com/dotnet/wpf/blob/d49f8ddb889b5717437d03caa04d7c56819c16aa/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/UncommonField.cs#L54
Maybe it should by optimized for boolean type ?
Here's the call stack:
UncommonField<bool>.SetValue()
TreeViewItem.System.Windows.Controls.Primitives.IHierarchicalVirtualizationAndScrollInfo.set_MustDisableVirtualization()
VirtualizingStackPanel.SetViewportForChild()
VirtualizingStackPanel.MeasureChild()
VirtualizingStackPanel.MeasureOverrideImpl()
VirtualizingStackPanel.MeasureOverride()
FrameworkElement.MeasureCore()
UIElement.Measure()
ContextLayoutManager.UpdateLayout()
ContextLayoutManager.UpdateLayoutCallback()
...
Thanks, @yingDev. I've added this to our performance backlog.