Repository navigation
NotImplementedException in Avalonia.Win32.WindowImpl.LoadIcon #20604
Replies: 2 comments
|
please provide a minimum sample for us to investigate further |
|
@timunie I'm currently facing this issue too, while working on a tray-icon implementation for a private app. Here is the reproduction that was missing. It is deterministic and does not Cause
case WindowsMessage.WM_GETICON:
if (_iconImpl == null)
{
break;
}
var requestIcon = (Icons)wParam;
var requestDpi = (uint)lParam;
...
return LoadIcon(requestIcon, requestDpi)?.Handle ?? default;
_iconCache[iconKey] = icon = type switch
{
Icons.ICON_SMALL => _iconImpl.LoadSmallIcon(scale),
Icons.ICON_BIG => _iconImpl.LoadBigIcon(scale),
_ => throw new NotImplementedException(),
};
Steps
Sending it from the same process does not reproduce it: the exception unwinds An icon must be set on the window. Without one, Result
Byte for byte the stack trace in the original report. Environment
How we hit it without sending anything ourselvesOur app lives in the notification area and hides its window instead of closing We are working around it by subclassing the window procedure and answering Suggested fixEither treat an unrecognised |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I encountered a NotImplementedException in the LoadIcon method of Avalonia.Win32.WindowImpl. This issue occurs when running the application, and it seems related to window icon handling.
The issue was reported by a user in Sentry, and the AppDomain.UnhandledException handler captured the error.
Error Details:
System.NotImplementedException: The method or operation is not implemented. at Avalonia.Win32.WindowImpl.LoadIcon(UnmanagedMethods.Icons, UInt32) at Avalonia.Win32.WindowImpl.AppWndProc(IntPtr, UInt32, IntPtr, IntPtr) at Avalonia.Win32.WindowImpl.WndProc(IntPtr, UInt32, IntPtr, IntPtr) at Avalonia.Win32.WindowImpl.WndProcMessageHandler(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)To Reproduce
Expected behavior
The application should initialize without throwing a NotImplementedException.
Avalonia version
11.2.7
OS
Windows
Additional context
No response
All reactions