.net 8: Crash in ItemsControlAutomationPeer using recycling
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
last line below: recyclableWrapper.**Peer** is null
```
protected override string GetNameCore()
{
AutomationPeer wrapperPeer = GetWrapperPeer();
string text = null;
object item = Item;
if (wrapperPeer != null)
{
text = wrapperPeer.GetName();
}
else if (item != null)
{
ItemsControlAutomationPeer itemsControlAutomationPeer = ItemsControlAutomationPeer;
if (itemsControlAutomationPeer != null)
{
using RecyclableWrapper recyclableWrapper = itemsControlAutomationPeer.GetRecyclableWrapperPeer(item);
text = recyclableWrapper.Peer.GetName();
}
}
```
this issue looks similar:
https://github.com/dotnet/wpf/pull/7115
### Reproduction Steps
Create an ItemsControl utilizing Groups with Recycling
### Expected behavior
Need a null check
### Actual behavior
Debugger reports exception
### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.