From f684b2b593ba23d2e457fc03c90d69d5b5312d44 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Fri, 7 Jun 2024 20:15:34 +0200 Subject: [PATCH] fix up some logic ive broken previously --- .../MS/Internal/AutomationProxies/WinEventTracker.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WinEventTracker.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WinEventTracker.cs index d5aea1a260c..7bdd1c728f3 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WinEventTracker.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/WinEventTracker.cs @@ -210,7 +210,7 @@ private static void WinEventProc(int winEventHook, int eventId, IntPtr hwnd, int try { - int evt = EventIdToIndex.Length > eventId ? EventIdToIndex[eventId] : -1; + int evt = EventIdToIndex.BinarySearch(eventId); if (evt < 0) return; // negative means this event is unknown so ignore it @@ -353,7 +353,7 @@ private static void BuildEventsList (EventFlag eFlag, IntPtr hwnd, ProxyRaiseEve EvtIdProperty evtIdProp = aEvtIdProp[i]; // Map a property into a WinEventHookProperty - int evt = EventIdToIndex.Length > evtIdProp._evtId ? EventIdToIndex[evtIdProp._evtId] : -1; + int evt = EventIdToIndex.BinarySearch(evtIdProp._evtId); // add the window to the list if (evt >= 0)