question

Amulya-2036 avatar image
0 Votes"
Amulya-2036 asked bkaankose commented

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

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???????

windows-uwp
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

There is no such limit in UWP. However, when you minimize the app it might go to suspended state. If you don't handle suspension properly, restoration might cause your app to crash. I am guessing this crash is not related to file deletion but more like suspension issue.

Please implement some kind of a diagnostic tool (like App Center) and provide a stacktrace for better diagnosing.

1 Vote 1 ·

Can you add the try-catch block to capture the exception, and you could integrate above code like the following.

 Task.Run(async () =>
 {
     StorageFile file = await StorageFile.GetFileFromPathAsync(path);
     await file.DeleteAsync();
 });


0 Votes 0 ·

0 Answers