Open elixss opened 1 month ago
sorry if i missed tags i don't do this very often this is a BUG i want to report this as a bug.
@Olina-Zhang can repro this issue?
@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):
https://github.com/user-attachments/assets/b2e18325-dde0-4780-b5fb-b130c0e79fec
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):
https://github.com/user-attachments/assets/ffc0e959-b824-4c31-90ff-f9375cea11fe
I see you got the same result. Is this a bug or an intended change?
@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?
@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.
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
#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);
}
@elixss On win11, it does not support changing the tray icon. Please see the sample program for details. WinFormsApp5.zip
.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.