UWP app is crashing when i am trying to delete 50000 + items

Amulya 41 Reputation points
2021-11-03T11:15:52.3+00:00

I have kept this code for deletion

StorageFile file = Task.Run(async () => await StorageFile.GetFileFromPathAsync(path)).Result;
Task.Run(async () => await file.DeleteAsync()).GetAwaiter().GetResult();

Please note that the app is crashing after some duration.
I have actually kept Progress ring but when you minimize and open back it crashes after some time

Is there any Files limit for deletion in UWP at a time???????

Developer technologies | Universal Windows Platform (UWP)
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.