dotnet / dotnet/winforms

System.Windows.Automation.InvokePattern.Invoke blocks on a menu item.

Open
#10,244 23 comments 0 reactions 1 assignee Claimed by @LeafShi1 View on GitHub
:boom: regression-release :construction: work in progress investigate tenet-accessibility waiting-on-team
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

7.0.403

### Did it work in .NET Framework?

Yes

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

Don't know, it works in .NET Framework 4.6.2, but not in latest version of .NET Framework 4.8

### Issue description

Run the unit test in the following solution. Notice that the unit test hangs on line 80 of UnitTest1.cs which is the InvokePattern.Invoke call on the FIle/Open... menu item. This makes it impossible to test any menu item using System.Automation?

### Steps to reproduce

1. on Windows 11 22H2 build 22621.2361
2. Load this solution into VS 2022
3. Run Test/Debug all tests
4. wait for windows open file dialog to appear
5. Notice it never disappears
6. hit break in the debugger and you will see it is blocked on line 80 of UnitTest1.cs.

[WinFormsApp1.zip](https://github.com/dotnet/winforms/files/13289996/WinFormsApp1.zip)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.