winforms icon indicating copy to clipboard operation
winforms copied to clipboard

ComboBox will block close all window WinForms .NET Framework 4.8

Open vsfeedback opened this issue 2 years ago • 4 comments

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


[severity:It bothers me. A fix would be nice] Hi support. Close all windows( taskbar -> right click icon -> close all window) can't work, with a asterisk sound when closing the form. The cause is the property 'AutoCompleteMode' are set not equal to None.

this.comboBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest

We discover that this control may not be disposed properly. A win32 error (code:1400) occurred when disposing the form.


Original Comments

Feedback Bot on 8/17/2022, 01:54 PM:

(private comment, text removed)

Ashley Li [MSFT] on 8/18/2022, 02:53 PM:

(private comment, text removed)

Luke Lu on 8/18/2022, 05:08 PM:

(private comment, text removed)


Original Solutions

(no solutions)

vsfeedback avatar Aug 19 '22 08:08 vsfeedback

.NET version .NET SDK 7.0.100-rc.2.22417.1

Did it work in .NET Framework? This issue is reproduced from .NET Framework 4.8, but it cannot repro in .NET Framework 4.6.2~4.7.2.

Did it work in any of the earlier releases of .NET Core or .NET 5+? No, it's not a regression issue, can repro on .NET Core 3.1/.NET 5.0/.NET 6.0.

Repro Steps:

  1. Extract "AppTest.zip" and open it in VS.
  2. Build and run the application.
  3. Click the GetNewForm button of Main Form designer on time to make a Child Form show up.
  4. Close all windows( taskbar -> right click icon -> close all window). --Put on headphones or turn on sound

Actual Result: The Main form cannot be closed and with a asterisk sound when closing the forms. issue7720_repro

Expected Result: All forms can be closed and without a asterisk sound when closing the forms. Issue7720_expected gif

More info:

  1. If we click the GetNewForm button of Main Form designer a few times to make multiple Child Forms show up, the forms all closed. The issue is not reproduced. Please see below gif: Issue7720_someTimes
  2. This issue is not related to the value of the ComboBox's AutoCompleteMode property being set to Suggest, because when it is set to None, the issue still occurs.

Ashley-Li avatar Aug 19 '22 09:08 Ashley-Li

@Tanya-Solyanik/ @vladimir-krestov, do you guys recall any work around Combo Box for .NET framework 4.8 that could have caused this?

dreddy-work avatar Aug 23 '22 21:08 dreddy-work

I checked my and the team previous codeflows related to ComboBox, we changed an accessibility part only, so I don't remember any changes related to this bug.

vladimir-krestov avatar Aug 28 '22 20:08 vladimir-krestov

Some more info on this.

  1. ComboBox is out of business here 😁 You can delete it from child form and will get same behavior.
  2. As @Ashley-Li mentioned the bug exists only if you open 1 or 2 child forms. If more - all will close.
  3. If you open child form and normally close it (with cross), then next child form opening will not have this bug.

kirsan31 avatar Aug 29 '22 19:08 kirsan31

This issue is now marked as "help wanted", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 180 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

ghost avatar Nov 03 '23 22:11 ghost

@Olina-Zhang can your team verify what we're seeing in .NET 8 and if something weird is still happening please rephrase the title of this to reflect what we see.

merriemcgaw avatar Nov 08 '23 18:11 merriemcgaw

@merriemcgaw it also repro in .Net 8 and the latest .Net 9 builds. And I try to create a simple application, form1 with button1 and empty form2. It has following code, also repro it.

private void button1_Click(object sender, EventArgs e)
{
    Form2 form2 = new Form2();
    form2.ShowDialog();
}

Form_ClosedIssue

Olina-Zhang avatar Nov 09 '23 02:11 Olina-Zhang

I did a quick test and clicking "Close All Windows" will send a WM_SYSCOMMAND message via WndProc which will then trigger WM_CLOSE.

On the first run of the "Close All Windows", it will trigger WM_SYSCOMMAND once and then the "error sound" will play when Dispose is hit in WmClose, which ends up calling NativeWindows.DestroyHandle which in turn calls PInvoke.DestroyWindow(HWND) (sound plays on the PInvoke call).

On the second it will trigger WM_SYSCOMMAND twice (one after the other) and no sound is played.

I think this might be an operating system bug?

@Olina-Zhang Maybe try a MFC app and see if it suffers from the same problem?

elachlan avatar Nov 13 '23 04:11 elachlan

This issue is reproduced from .NET Framework 4.8, but it cannot repro in .NET Framework 4.6.2~4.7.2.

So that rules out an OS issue, I guess?

elachlan avatar Nov 13 '23 04:11 elachlan

@Olina-Zhang Maybe try a MFC app and see if it suffers from the same problem?

Verified it in a MFC app I created, CloseWindow by "taskbar -> right click app icon -> Close Window" doesn't work when second dialog opening. MFC_CloseWindow

Olina-Zhang avatar Nov 13 '23 07:11 Olina-Zhang

Interesting @Olina-Zhang that tends to point more to some Win32 API issues. Can you check a Win10 OS and see if the OS version is the key to whether MFC (and .NET based) works?

If this is us (but with MFC doing the same thing I doubt it) then I'd want a fix in .NET 9 if possible. If it's Win10 vs Win11, I'd be interested to know if the later .NET Framework versions on the older Win10 builds exhibit the same problem.

merriemcgaw avatar Nov 30 '23 01:11 merriemcgaw

@merriemcgaw I tested it on Win10 22H2 OS in MFC application, it is same as above Winforms behavior(GIF) I attached.

https://github.com/dotnet/winforms/assets/26474449/a8215cde-eeeb-42d2-ba81-496aca4476ad

Olina-Zhang avatar Dec 04 '23 03:12 Olina-Zhang

@Olina-Zhang has an internal ticket been raised? I Imagine that is the next step.

elachlan avatar Dec 04 '23 04:12 elachlan

@elachlan No, I am not sure what is the exactly path of Windows team about this issue. @merriemcgaw can you point to me if it needs?

Olina-Zhang avatar Dec 04 '23 05:12 Olina-Zhang

I would just use Windows Feedback I think. Attach the videos from both UI stacks. Someone will route it to the right place. I too don't know which of the many Windows teams it would be. If it were common controls, or common dialog, or even Win32 I could find it.

merriemcgaw avatar Dec 04 '23 17:12 merriemcgaw

Thanks @merriemcgaw, I have submitted a feedback to Windows by Windows feedback. Closing this issue now.

Olina-Zhang avatar Dec 05 '23 09:12 Olina-Zhang