Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

UI Automation Framework AddAutomationFocusChangedEventHandler Memory Leak in Internet Explorer 11 on Server 2019

$
0
0

I've noticed that any time the UI Automation Focus Change event is hooked, Internet Explorer will leak memory with every page load.  This only happens on Server 2019, which is an issue when running thin clients.  Is there any solution to this issue?

Environment:

Windows Server 2019 Standard V 10.0.17763 Build 17763

Internet Explorer 11 Version 11.678.17763.0 Update Version 11.0.140 (KB4511872)

Sample console application to trigger the memory leak:

Program.cs:

using System;

namespace UIAWorkBench
{
    class Program
    {

        static void Main(string[] args)
        {
            UIAutomationWorker worker;

            Console.WriteLine("Starting Watcher ...");
            worker = new UIAutomationWorker();

            Console.WriteLine("Subscribe Focus Change Event");
            worker.SubscribeFocusChange();

            Console.WriteLine("Watching ...");
            Console.ReadLine();
        }

    }
}

UIAutomationWorker.cs:

using System;
using System.Windows.Automation;

namespace UIAWorkBench
{
    class UIAutomationWorker
    {

        public UIAutomationWorker()
        {
        }
        public void SubscribeFocusChange()
        {
            try
            {
                // Hook Focus Change Event
                Automation.AddAutomationFocusChangedEventHandler(UIAFocusChange);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        private void UIAFocusChange(Object sender, AutomationFocusChangedEventArgs e)
        {
            // Do Nothing
        }

    }
}


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>