H.NotifyIcon
H.NotifyIcon copied to clipboard
NullReferenceException when hover at tray icon in WinUI3
Describe the bug
When I run the app and hover over the system tray icon, it crashes with a NullReferenceException.
System.NullReferenceException
HResult=0x80004003
Message = Object reference not set to an instance of an object.
Source = WinRT.Runtime
TraceStack:
в WinRT.ExceptionHelpers.<ThrowExceptionForHR>g__Throw|20_0(Int32 hr)
в H.NotifyIcon.TaskbarIcon.OnToolTipChange(Object sender, Boolean visible)
в H.NotifyIcon.Core.MessageWindow.ProcessWindowMessage(UInt32 msg, WPARAM wParam, LPARAM lParam)
в H.NotifyIcon.Core.MessageWindow.OnWindowMessageReceived(HWND hWnd, UInt32 msg, WPARAM wParam, LPARAM lParam)
Steps to reproduce the bug
- Create WinUI3 application
- Add H.NotifyIcon packages
- Add to my window grid tb:TaskbarIcon with ToolTipText
- Run app and hover over the system tray icon of app
Expected behavior
No response
Screenshots
No response
NuGet package version
2.0.59
Platform
WinUI
IDE
Visual Studio 2022
Windows Version
Windows 10
WindowsAppSDK Version
1.1
Additional context
If ToolTipText is empty there is no error
Thanks for the problem. Please check 58, 57 and 56 versions of the package for this issue. So far, I suspect that this is because code like this throws this exception on Windows 10:
var args = new global::Microsoft.UI.Xaml.RoutedEventArgs();
This was added in one of the updates to https://github.com/HavenDV/DependencyPropertyGenerator to implement support for RoutedEvents for the WinUI platform.