I have the following code where if i remove the ´Task.Delay´ it throws an UnhandledException with message "Unspecified error". This exception is not thrown from the actual code and will not be captured by any try catch.
ViewModel Code:
ObservableCollection<Data> _newData;
ObservableCollection<Data> _oldData;
List<Data> dataList = await Task.Run(() => GetData());
foreach(var dataItem in dataList)
{
if(dataItem.Type == DataType.New)
_newData.Add(dataItem);
else
_oldData.Add(dataItem);
await Task.Delay(1); // Comment out and code fails
}
This only happens as the´dataList´ grows large enough.
Turned out to be a completely unrelated issue.
Replacing a MenuFlyout
with a Flyout
solved the problem. I am unsure why exactly.