Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetAllTopLevelWindows takes forever #596

Open
aristotelos opened this issue Nov 23, 2023 · 3 comments
Open

GetAllTopLevelWindows takes forever #596

aristotelos opened this issue Nov 23, 2023 · 3 comments

Comments

@aristotelos
Copy link

aristotelos commented Nov 23, 2023

Describe the bug
GetAllTopLevelWindows sometimes takes many seconds to complete, blocking process of the app.

I have also tried:

Automation.GetDesktop().FindAllChildren();
Automation.GetDesktop().FindAllChildren(cf => cf.ByProcessId(App.ProcessId));
Automation.GetDesktop().FindAllChildren(cf => cf.ByControlType(ControlType.Window));

They all timeout.

Code snippets

App.GetAllTopLevelWindows(Automation)

Additional context

Using UIA3. Caching is not enabled. When I browse to the dependency used in Visual Studio it is:

#region Assembly Interop.UIAutomationClient, Version=10.0.19041.0, Culture=neutral, PublicKeyToken=null
// ..\.nuget\packages\interop.uiautomationclient\10.19041.0\lib\netstandard2.0\Interop.UIAutomationClient.dll
// Decompiled with ICSharpCode.Decompiler 7.1.0.6543
#endregion
@aristotelos aristotelos changed the title GetAllTopLevelWindows times out if the process was closed GetAllTopLevelWindows takes forever Nov 24, 2023
@Roemer
Copy link
Member

Roemer commented Mar 8, 2024

This issue popped up from someone else. Are you able to debug into the FindAllChildren to see where it blocks?

@aristotelos
Copy link
Author

aristotelos commented Mar 12, 2024

Yes, it's in the NativeElement.FindAll call called from UIA3FrameworkAutomationElement.FindAll:
image

@sancanella
Copy link

Same here. The instruction blocks the process. Sometimes takes seconds and sometimes minutes. Here is the call stack:
image

grokys added a commit to grokys/FlaUI.WebDriver that referenced this issue May 7, 2024
This was removed due to FlaUI/FlaUI#596, which I would like to investigate, however I've so far been unable to repro the issue. Maybe if the failing code path is enabled then I'll hit it and will be able to investigate.

Also, I need to be able to retrieve all open window handles, so only returning the main window and modal windows is a problem for me...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants