CsWinRT
CsWinRT copied to clipboard
Bug: CollectionViewSource crash in PublishAoT mode when using IEnumerable
Description
Binding this with PublishAoT causes a runtime crash:
{
get
{
var groups = (from item in Samples
orderby item.Category
group item by item.Category into g
select new SampleGroup(g) { Key = g.Key ?? "Misc" });
return groups; // If you add .ToList() here no crash
}
}
CollectionViewSource m_CollectionViewSource;
public CollectionViewSource CollectionViewSource
{
get
{
if(m_CollectionViewSource == null)
{
m_CollectionViewSource = new CollectionViewSource()
{
IsSourceGrouped = true,
Source = SamplesByCategory,
ItemsPath = new PropertyPath("Items")
};
}
return m_CollectionViewSource;
}
}
}
Steps To Reproduce
- Run the attached project: App17.zip
- Observe the crash:
- Remove PublishAoT=true and sample runs
- Add ToList() to the SamplesByCategory return value, and problem goes away
Expected Behavior
No crash ;-)
Version Info
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.6.241106002" />
Additional Context
No response