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

.NET 8 WPF App - UI Automation Broken - Same App .NET 6 - UI Automation works #8800

Closed
vsfeedback opened this issue Feb 12, 2024 · 1 comment

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version]
We have a WPF application that tested daily via UI Automation tests. We can currently successfully test and record results when we compile our application as a .NET 6 application. However, when we compile the same application as a .NET 8 application the tests fail to detect some UI elements, which causes our tests to fail.

The UI tree in tools such as (UI Spy, Inspect, Accessibility Insights, etc.) we have discovered that some elements are not displayed in the tool's UI tree. For instance, when using the Inspect.exe tool, and we navigate through a wizard, page by page, only the first wizard page's child controls are displayed in Inspect's UI tree. This behavior is exhibited whether using Raw View, Control View, or Content View.

All tools that we have tried exhibit the same problem.


Original Comments

Tom Wells on 2/1/2024, 02:03 PM:

(private comment, text removed)

Tom Wells on 2/1/2024, 03:03 PM:

(private comment, text removed)

Feedback Bot on 2/1/2024, 04:54 PM:

(private comment, text removed)

Ann Yang [MSFT] on 2/1/2024, 07:20 PM:

(private comment, text removed)

Tom Wells on 2/2/2024, 04:00 PM:

(private comment, text removed)

Tom Wells on 2/2/2024, 04:03 PM:

(private comment, text removed)

Ann Yang [MSFT] on 2/4/2024, 07:13 PM:

(private comment, text removed)

Feedback Bot on 2/7/2024, 10:46 PM:

(private comment, text removed)

Tom Wells on 2/8/2024, 02:42 PM:

(private comment, text removed)

Tom Wells on 2/9/2024, 01:42 PM:

(private comment, text removed)


Original Solutions

(no solutions)

@rchauhan18
Copy link
Contributor

This issue is similar as #8679
Here is the whole discussion regarding the cause for regression and workaround: #8715

WorkAround:
Set the ItemsControlDoesNotSupportAutomation to true before WPF application Initialization.

public class Program
{
    [STAThread]
    static void Main()
    {
        AppContext.SetSwitch("Switch.System.Windows.Controls.ItemsControlDoesNotSupportAutomation", true);

        var app = new App();
        app.InitializeComponent();
        app.Run();
    }
}

I have tried this workaround on the sample application mentioned in the issue and here is the UI automation tree using Accessibility Insights

image

We are closing this issue and will continue the discussion on the original issue.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants