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

NotifyIcon.Icon updates not displayed in Notifications in Windows 11 #12373

Open
elixss opened this issue Oct 23, 2024 · 8 comments
Open

NotifyIcon.Icon updates not displayed in Notifications in Windows 11 #12373

elixss opened this issue Oct 23, 2024 · 8 comments
Labels
external-OS-issue Issue caused by an external OS component such as Common Controls.

Comments

@elixss
Copy link

elixss commented Oct 23, 2024

.NET version

.NET 8

Did it work in .NET Framework?

Not tested/verified

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

Yes, .NET 6, 7 and 8 on Windows 10.

Issue description

Hello!

I stumbled accross some sort of bug.

When using the NotifyIcon class and setting an icon, the notifications sent by that NotifyIcon using ShowBalloonTip don't match if that icon was updated.
This only happens on Windows 11. I tested it on various machines, 3 Windows 10 machines and 3 windows 11 machines, one of them Windows 11 machines was 24H2. all windows 10 were 22H2.

Steps to reproduce

I created a repo for that! https://github.com/elixss/NotifyIconTest

Clone it, run it and compare: on windows 10 the icons will match from notifications and tray, on windows 11 they won't.

@elixss elixss added the untriaged The team needs to look at this issue in the next triage label Oct 23, 2024
@elixss
Copy link
Author

elixss commented Oct 23, 2024

sorry if i missed tags i don't do this very often this is a BUG i want to report this as a bug.

@JeremyKuhne
Copy link
Member

@Olina-Zhang can repro this issue?

@John-Qiao
Copy link
Member

@JeremyKuhne yes, we can repro this issue in Win11 OS, please check below details:

In Win10 machine (.NET 6.0, .NET 8.0, .NET 9.0, .NET 10.0 and .NET Framework 4.8.1 all are the same result):

Image

Win10-testresult.mp4

In Win11 machine (.NET 6.0, .NET 8.0, .NET 9.0, .NET 10.0 and .NET Framework 4.8.1 all are the same result):

Image

Win11-testresult.mp4

@elixss
Copy link
Author

elixss commented Oct 29, 2024

I see you got the same result. Is this a bug or an intended change?

@elachlan elachlan added the external-OS-issue Issue caused by an external OS component such as Common Controls. label Oct 30, 2024
@merriemcgaw
Copy link
Member

merriemcgaw commented Oct 31, 2024

@Olina-Zhang can you check the AzDO instance to see if they have a bug there already tracking this on the Windows side?
@LeafShi1 can your team create an MFC application that mimics our NotifyIcon behavior to see if this is also reproduced in native code?

@merriemcgaw merriemcgaw removed the untriaged The team needs to look at this issue in the next triage label Oct 31, 2024
@Olina-Zhang
Copy link
Member

@Olina-Zhang can you check the AzDO instance to see if they have a bug there already tracking this on the Windows side?

No AzDo Windows bug related this issue exists.

@LeafShi1
Copy link
Member

LeafShi1 commented Nov 1, 2024

Try to use Shell_NotifyIcon simulation, but in win11, the notification message cannot pop up.
nid.hIcon = LoadIcon(NULL, IDI_WARNING) control which icon is displayed. How the icon mentioned in the question is displayed is not within the control range of our code. We can only set the following icon in the code

Image

#include <windows.h>
#include <strsafe.h>

BOOL CMFCApplication1Dlg::OnInitDialog()
{
	NOTIFYICONDATAW nid;
	ZeroMemory(&nid, sizeof(nid));
	nid.cbSize = sizeof(nid);
	nid.hWnd = NULL;
	nid.uID = 1;
	nid.uFlags = NIF_INFO | NIF_MESSAGE | NIF_ICON;
	nid.hIcon = LoadIcon(NULL, IDI_WARNING);
	nid.uCallbackMessage = WM_USER + 1;
	StringCchCopy(nid.szTip, ARRAYSIZE(nid.szTip), L"Tip");
	StringCchCopy(nid.szInfo, ARRAYSIZE(nid.szInfo), L"This is a warning");
	StringCchCopy(nid.szInfoTitle, ARRAYSIZE(nid.szInfoTitle), L"Warning");
	nid.dwInfoFlags = NIIF_WARNING;
	Shell_NotifyIcon(NIM_ADD, &nid);
	Shell_NotifyIcon(NIM_MODIFY, &nid);
	Sleep(5000);
	Shell_NotifyIcon(NIM_DELETE, &nid);
}

@LeafShi1 LeafShi1 removed their assignment Nov 5, 2024
@LeafShi1
Copy link
Member

LeafShi1 commented Nov 5, 2024

@elixss On win11, it does not support changing the tray icon. Please see the sample program for details.
WinFormsApp5.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external-OS-issue Issue caused by an external OS component such as Common Controls.
Projects
None yet
Development

No branches or pull requests

7 participants