Env:
GUI: WinUi3
IDE: VS2022
System: Win11
Question:
I try to add the List content to the DataSource again after clearing the DataSource, and there is a chance to throw the following error:
Attempted to read or write protected memory. this is often an indication that other memory is corrupt

My Code:
public ObservableCollection<ExplorerItem> DataSource = new ObservableCollection<ExplorerItem>();
public List<Object> List = new List<Object>();
// ..
this.DataSource.Clear();
List.ForEach(c => DataSource.Add(new ExplorerItem() {
Name = c.Name,
Id = c.Id
}));