-
Notifications
You must be signed in to change notification settings - Fork 961
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
First time set Form.Text in Load event will cause no taskbar icon when program startup without focus #9770
Comments
https://stackoverflow.com/a/16343373 There are stack overflow posts from 2009 about it. I imagine the underlying window in the winapi requires the window have a name prior to creating it. It also got reported via developer community: |
@elachlan Thank you, that can't explain why no issue when assignment in |
@Olina-Zhang can you see if you can repro this on .NET 7 or 8? I wasn't successful in my initial attempts. |
Yes, can also repro it on .NET7 and .NET8. Once launch application or exe, you should mouse click other place immediately with losing focus for winforms runtime. In that case, no taskbar icon of winforms runtime displays until it gets focus again. |
@Olina-Zhang What's the screen record tool you using please? |
@ahdung I use ScreenToGif tool from https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/33999/How-to-record-your-screen. |
@ahdung or use it from https://www.screentogif.com/ if you cannot access above link. |
@Olina-Zhang Thank you very much. |
.NET version
.netfx2.0-.net6.0 tested, I believe it's ALL of .net versions.
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
Meet follow conditions, .net winform app will no icon on taskbar:
Form.Text
is inLoad
event.Form.Text
inconstructor
orInitializeComponent
.Steps to reproduce
NoTaskbarIconDemo.zip
exe
included.Text
assignment in Form1.Designer.cs is commented.Thread.Sleep
inprogram.cs
is for simulate production programs that need long startup time, so in this time it might happen many thing like lost focus, users usually don't wait only for you.f9071f86-eb3b-4821-8f31-3e506392a68d.mp4
The text was updated successfully, but these errors were encountered: