This happens because SfAccordion.Dispose() doesn’t detach the OnMouseLeave event. Try unhooking the event before disposing, or ensure it’s not hovered at disposal. You can also report it so Syncfusion can fix in future builds.
OnMouseLeave Throws Null Object Reference Exception After Disposing SfAccordion
When removing components from the visual tree, and SfAccordion's Dispose() method is called. An error is thrown if the mouse is already hovered over the accordion.
This is caused by SfAccordion's Dispose() method not unhooking the OnMouseLeave() event listener. Causing null reference exceptions when OnMouseLeave(MouseEventArgs e) is fired after disposal.
Stack Trace
{"ClassName":"System.NullReferenceException","Message":"Object reference not set to an instance of an object.","Data":{"System.Object":null},"InnerException":null,"HelpURL":null,"StackTraceString":" at Syncfusion.Windows.Controls.Layout.SfAccordionItem.OnMouseLeave(MouseEventArgs e)\r\n at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)\r\n at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)\r\n at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action`2 originChangedAction)\r\n at System.Windows.Input.MouseDevice.ChangeMouseOver(IInputElement mouseOver, Int32 timestamp)\r\n at System.Windows.Input.MouseDevice.PreProcessInput(Object sender, PreProcessInputEventArgs e)\r\n at System.Windows.Input.InputManager.ProcessStagingArea()\r\n at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)\r\n at System.Windows.Interop.HwndMouseInputProvider.PossiblyDeactivate(IntPtr hwndCapture, Boolean stillActiveIfOverSelf)\r\n at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)","RemoteStackTraceString":null,"RemoteStackIndex":0,"ExceptionMethod":null,"HResult":-2147467261,"Source":"Syncfusion.SfAccordion.WPF","WatsonBuckets":null},"CallingMethod":"Application_DispatcherUnhandledException","CallingLine":455,"ID":"e78ee8410fdd4906a3f6db2d7ff2c301"}
SIGN IN To post a reply.
4 Replies
VF
Victoria Farrell
October 2, 2025 09:57 AM UTC
KS
Koppolu Sai Sivani Koppolu Ragaiah
Syncfusion Team
October 3, 2025 07:08 AM UTC
Hi Steve,
We have confirmed the reported scenario is a defect and logged a report for the reported scenario, "NullReferenceException thrown when mouse hovers the accordion item during disposal". We will fix this issue and include it in our NuGet release, which is scheduled for 7th October 2025.
You can track the status of this defect using the following feedback link: NullReferenceException thrown when mouse hovers the accordion item during disposal in WPF | Feedback Portal
Please let us know if you need any further assistance.
Note: The provided feedback link is private, and you need to log in to view this feedback.
Disclaimer: "Inclusion of this solution in the weekly release may change due to other factors including, but not limited to, QA checks and work reprioritization."
Regards,
K Sai Sivani
KS
Koppolu Sai Sivani Koppolu Ragaiah
Syncfusion Team
October 8, 2025 10:10 AM UTC
Hi Steve,
Sorry for the inconvenience.
We were unable to include the fix for the issue "NullReferenceException thrown when mouse hovers over the accordion item during disposal" as promised in this weekly release. We have planned to include the fix in the upcoming SP release scheduled for this month.
We appreciate your patience until then.
Regards,
K Sai Sivani
KS
Koppolu Sai Sivani Koppolu Ragaiah
Syncfusion Team
October 16, 2025 07:28 AM UTC
Hi Steve,
We are glad to announce that our Essential Studio® 2025 Volume 3 Service Pack 1 Release v31.2.2 has been rolled out with a fix for the issue "NullReferenceException thrown when mouse hovers over the accordion item during disposal" and is available for download under the following link.
Essential Studio® 2025 Volume ... | Announcements Forums | Syncfusion®
Feedback link: NullReferenceException thrown when mouse hovers over the accordion item during disposal in WPF | Feedback Portal
We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you require any further assistance.
Regards,
K Sai Sivani
SIGN IN To post a reply.
- 4 Replies
- 3 Participants
-
SF Steve Fotso
- Sep 29, 2025 05:20 PM UTC
- Oct 16, 2025 07:28 AM UTC