NullReferenceException - StiWpfViewerControl.view_MouseLeave

Stimulsoft Reports.WPF discussion
Post Reply
sandynith
Posts: 64
Joined: Thu Dec 12, 2013 4:03 am

NullReferenceException - StiWpfViewerControl.view_MouseLeave

Post by sandynith »

Hi,

Stimulsoft Wpf 2014.2.2001

We are getting following unhandled exception from the Stimulsoft.Report.Wpf.dll which is causing a crash in our product.
This is a intermittent problem.

System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Stimulsoft.Report.Wpf
StackTrace:
at Stimulsoft.Report.Viewer.StiWpfViewerControl.view_MouseLeave(Object sender, MouseEventArgs e)
at System.Windows.Input.MouseEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.MouseOverProperty.FireNotifications(UIElement uie, ContentElement ce, UIElement3D uie3D, Boolean oldValue)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action`2 originChangedAction)
at System.Windows.ReverseInheritProperty.OnOriginValueChanged(DependencyObject oldOrigin, DependencyObject newOrigin, IList`1 otherOrigins, DeferredElementTreeState& oldTreeState, Action`2 originChangedAction)
at System.Windows.Input.MouseDevice.ChangeMouseOver(IInputElement mouseOver, Int32 timestamp)
at System.Windows.Input.MouseDevice.PreNotifyInput(Object sender, NotifyInputEventArgs e)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at Cardax.FT.Client.App.Main() in c:\Dev\FTMain\Elmo\WPFClient\Client\CommandCentreClient\obj\Debug\App.g.cs:line 0
InnerException: null

The .Net Reflector decompiled code looks as follows:

Code: Select all

//Stimulsoft.Report.Viewer.StiWpfViewerControl.view_MouseLeave
private void view_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
{
	if (this.componentsMouseOver != null)
	{
		foreach (StiComponent stiComponent in this.componentsMouseOver.Values)
		{
			stiComponent.InvokeMouseLeave(stiComponent, EventArgs.Empty);
			this.InvokeMouseLeaveComponent(stiComponent, EventArgs.Empty);
			this.ProcessChartInteractionMouseLeave(stiComponent);
		}
	}
	this.componentsMouseOver.Clear();    //************ componentsMouseOver is Null when exception occurs******** 
}
this.componentsMouseOver.Clear(); - At first place you should not try to clear the componentsMouseOver without doing a Null check.
I think this line of code should be inside the if (this.componentsMouseOver != null) condition block.

Its worth mentioning that we never saw this problem with 2014.1.1800 version and its started happening intermittently after updating to 2014.2.2001
This exception happens when I quickly switch between various reports and while doing it move my mouse around the report viewer area.
Its hard for me to provide a sample code showing the problem as its intermittent.

For your advice please.

Thanks,
Sandeep
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: NullReferenceException - StiWpfViewerControl.view_MouseL

Post by HighAley »

Hello, Sandeep.

We have made an improvement.
Please, check our next prerelease build.

Thank you.
Post Reply