1

I have recently created a webview C# Universal Windows application to run on a Raspberry Pi 3 device using Windows IOT.

Here is the code for the program:

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq; //XElement - loads and parses XML
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using System.Threading.Tasks;
using System.Threading;


namespace WindowsIOTBrowser
{
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
            TaskDelay(); //calls TaskDelay Method
        }

        public async void TaskDelay()
        {
            XElement xelement = XElement.Load("URLs.xml"); //loads and reads XML file - located in \WindowsIOTBrowser\WindowsIOTBrowser\bin\x86\Debug\AppX
            IEnumerable<XElement> urls = xelement.Elements(); //assigns URLs to variable

            while (true) //loops infinitely
            {
                foreach (var url in urls) //loops and navigates through each URL
                {
                    var value = url.Element("Address").Value;
                    var delay = url.Element("Delay").Value;
                    webView.Navigate(new Uri(value));
                    await Task.Delay(int.Parse(delay) * 1000);  //sets page rotation to time set on XML file - In milliseconds * 1000 to get seconds
                }
                this.NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Enabled;
                webView.Refresh();
            }
        }

    }
}

This code has a webview that navigates and rotates through webpages found in an XML document with a delay between loading each page. It does this on a infinite loop.

Any help trying to figure out what keeps crashing the application? I feel that it could be a memory leak or cache buildup.

Thanks!

  • Any details on the crash? Like some kind of Exception output? Any justification for why you think it's a memory leak? – Ceisc May 22 '17 at 21:52
  • The program would work perfectly for a few hours and then all of a sudden it would crash and be stuck on the boot screen. I tried to look at the crash log, but it isn't giving a specific issue. I feel that it could be a cache buildup or a memory leak because of the infinite loop through the pages that I have it on, but I am uncertain. – tylergage123 May 22 '17 at 21:56
  • How long does the app run before crashing? What's your os version? – Rita Han May 23 '17 at 09:39
  • It lasts somewhere between one to two hours before crashing. I am running Windows 10. – tylergage123 May 23 '17 at 14:56

0 Answers0