Windows Forms Application Icon suddenly shows as default icon or does not update color after KB5051989 update

Emmanuel Guballa 25 Reputation points
2025-03-06T08:36:12.63+00:00

Hi,

Our C# Windows Forms Application icon (in the taskbar) suddenly shows as default icon or sometimes doesn't update its color (based on the customization) after installing the KB5051989 update. This has been working for 15 years, and the issue just appeared after the said update. Removing the update will make it work as usual. We have a VM that only have the KB5051979 update and there, the problem doesn't show up. The issue was also experienced by our clients, and we can also see this internally. Even after clearing the icon cache and rebuilding it, the problem still occurs.

There were a few cases, wherein I locked my machine while the application is running. And when I came back and logged in after a few minutes, the icon is displayed properly and with the correct color customization.

Here is a sample screenshot of the issue.

Image

And here is the working one, without the update.

Image

Here is the case where the taskbar icon did not update the color in the taskbar, but it is correctly shown in the Task Manager and in the live preview:

2025-03-06 16_31_07-

Is there something with K8SOS1989 update that may have affected taskbar icons of windows forms applications?

Any other advice that we can try to make it work as before?

Regards,

Emman G

Developer technologies | Windows Forms

6 answers

Sort by: Newest
  1. Ossowski, Marek 0 Reputation points
    2026-09-04T17:13:44.1233333+00:00

    For me it helped to execute Application.DoEvents() a few times.

    Was this answer helpful?

    0 comments No comments

  2. Dániel Kékesi 0 Reputation points
    2026-04-17T19:19:31.16+00:00

    I have reproduced this issue as well. Interestingly only C# applications are affected, VB.NET is fine. Has there been a fix from MS on this?

    Was this answer helpful?

    0 comments No comments

  3. CL97 5 Reputation points
    2025-10-27T15:56:34.5966667+00:00

    I was able to reproduce the issue with a minimal WinForms app. The problem seems to occur when the application is blocked for too long after setting the icon.

    public partial class Form1 : Form
    {
        public Form1()
        {
            this.Shown += Form1_Shown;
            InitializeComponent();
        }
        private void Form1_Shown(object? sender, EventArgs e)
        {
            var resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            Icon = (Icon)resources.GetObject("AppIcon");
            Thread.Sleep(1000); //The icon is shown if sleep time is ~600ms or below
        }
    }
    
    

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments

  4. Emmanuel Guballa 25 Reputation points
    2025-05-30T03:14:58.7133333+00:00

    Hello,

    Just would like to give an update here for those who also encountered the problem.

    We created a Microsoft ticket for this issue and logs were collected from my machine. But they cannot see any anomaly and asked us to provide a simple winform application where it can be reproduced. We failed to reproduce this problem on a simple app and there it always works.

    After more research related to taskbar icon problem, I found this: https://www.reddit.com/r/WindowsHelp/comments/1grzcdy/comment/mrgsllj/. And after trying the suggestion here, I observed that the taskbar gets refreshed after changing some settings, so I looked for a way to refresh the taskbar in C# and found this: https://www.reddit.com/r/Windows11/comments/12ygqei/how_can_i_refresh_the_taskbar_after_making_some/?rdt=45820.

    We ended up refreshing the taskbar using the SendMessage function (from user32.dll) after setting the icon and this worked for us.

    private const int HWND_BROADCAST = 0xffff;
    private const int WM_SETTINGCHANGE = 0x001a;
    
    [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
    [DefaultDllImportSearchPaths(DllImportSearchPath.SafeDirectories)]
    public static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, string lParam);
    
    //refresh taskbar to prevent blank (default) exe icon
    SendMessage((IntPtr)HWND_BROADCAST, WM_SETTINGCHANGE, IntPtr.Zero, "Policy");
    

    Hope this can help others who are experiencing the same problem.

    Was this answer helpful?

    3 people found this answer helpful.

  5. Gschwandegger Gerald 5 Reputation points
    2025-05-20T12:23:37.52+00:00

    Hi,

    after spending a lot of time with this issue i found i simple solution for my projects. I added the icon assignment in the Load method of the form and know in all projects the icon is showing in the taskbar ;)

       private void Form1_Load(object sender, EventArgs e)
       {
           this.Icon = new Icon("xxx.ico");
       }
    

    Was this answer helpful?

    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.