System.Windows.UncommonField<bool>.SetValue generating garbage
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
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:
```C#
UncommonField.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()
...
```
Contributor guide
Assessment
This issue has not been assessed yet.