UWP app crashing

Madhu 96 Reputation points


Our UWP app contains many web views and also it loads image/videos etc.. When using the app to load lot of data continuously the app crashes. In different machines this seems to happen at different memory levels. In my machine when the app uses more than 600mb roughly it seems to crash. But the total memory of the machine is at 50%.

  1. When a UWP app crashes like that, is there a way to identify the exact issue of that crash? Does it write to the System log in the Windows?
  2. Assuming the reason for the crash is memory, is there a way to set a higher memory level for the app? (from the code also we have done memory releasing, where we have noticed memory issues and if we give time for the app to load data then it releases the memory to a certain extent. The crashing happens if the user load data very quickly)
  3. Are there any specific things we need to do in the code related to memory handling/releasing

Thank you.

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Matt Lacey 791 Reputation points MVP

    Using multiple webviews is a red flag for me.
    If you're loading content from a remote source (over the web) then the amount of memory used to render that content. Reclaiming that memory can also be a challenge.

    I'd start by avoiding using multiple webviews and just create one that you reuse across multiple pages as necessary. (You may need to remove and reassign the parent or create at a "shell" level depending on the structure of your app.)
    If you need multiple webviews on a single XAML page I'd also see if you can change things to avoid that if possible.

    Of course, first use the built-in diagnostic tools to determine if this is where you should be looking https://learn.microsoft.com/en-us/visualstudio/profiling/profiling-feature-tour?view=vs-2019

    3 people found this answer helpful.

  2. Daniele 1,991 Reputation points

    I suggest to use a AppCenter Diagnostics to collect information about crashes. You can find related documentation for UWP at https://learn.microsoft.com/en-us/appcenter/sdk/crashes/uwp and https://learn.microsoft.com/en-us/appcenter/diagnostics/windows-support, and more general information at https://learn.microsoft.com/en-us/appcenter/diagnostics/.

    2 people found this answer helpful.