New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException at OnMouseEnter in LayoutAnchorableTabItem #1354

Open
Chocko opened this Issue Jul 19, 2018 · 12 comments

Comments

Projects
None yet
7 participants
@Chocko
Copy link

Chocko commented Jul 19, 2018

Hello,

when using the Avalon Dock v3.4 (i.e. Git Commit c0d3a0a), there are sporadic NullReferenceExceptions in the OnMouseEnter method in the LayoutAnchorableTabItem (line 197). I guess its the "_draggingItem" which is null.

Line 197:
containerPane.MoveChild( childrenList.IndexOf( _draggingItem.Model ), childrenList.IndexOf( model ) );

Details:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Xceed.Wpf.AvalonDock
StackTrace:
at Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableTabItem.OnMouseEnter(MouseEventArgs e) in (...)\wpftoolkit\ExtendedWPFToolkitSolution\Src\Xceed.Wpf.AvalonDock\Controls\LayoutAnchorableTabItem.cs:line 197

@Chocko

This comment has been minimized.

Copy link
Author

Chocko commented Jul 19, 2018

Btw, in Commit 24ecc09 (v3.4) there was the check at the beginning of the method (_draggingItem != null) removed...

@isbeorn

This comment has been minimized.

Copy link

isbeorn commented Jul 23, 2018

Hi there,

my application experiences the same issue after updating to avalondock 3.4.

Object reference not set to an instance of an object. at Xceed.Wpf.AvalonDock.Controls.LayoutAnchorableTabItem.OnMouseEnter(MouseEventArgs e)
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.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction) at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction)
at System.Windows.ReverseInheritProperty.FirePropertyChangeInAncestry(DependencyObject element, Boolean oldValue, DeferredElementTreeState treeState, Action2 originChangedAction) at System.Windows.ReverseInheritProperty.OnOriginValueChanged(DependencyObject oldOrigin, DependencyObject newOrigin, IList1 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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

@Chocko

This comment has been minimized.

Copy link
Author

Chocko commented Jul 24, 2018

Hi isbeorn,

thanks for your answer. Just in case you need a workaround: I have downloaded the repository and added the null-check at line 184 like this:

if( _draggingItem != null && 
    _draggingItem != this &&
    e.LeftButton == MouseButtonState.Pressed )

I guess this solves the issue...

Here is a patch file:
issue#1354_workaround_patch.diff.txt

@XceedBoucherS

This comment has been minimized.

Copy link
Collaborator

XceedBoucherS commented Jul 25, 2018

Hi,
This is already fixed in v3.5 and up with the check " _draggingItem != null".
Thank you.

Dirkster99 added a commit to Dirkster99/AvalonDock that referenced this issue Jul 31, 2018

JesperRisager added a commit to JesperRisager/wpftoolkit that referenced this issue Sep 6, 2018

RecursiveNerd added a commit to RecursiveNerd/wpftoolkit that referenced this issue Oct 15, 2018

Fixes NullReferenceException in xceedsoftware#1354
This issues a fix for the NullReferenceException that occurs in v3.4 of AvalonDock when the _draggingItem is null on MouseEnter (reference issue xceedsoftware#1354).
@PavelG2010

This comment has been minimized.

Copy link

PavelG2010 commented Nov 16, 2018

This is already fixed in v3.5 and up with the check " _draggingItem != null".

I downloaded the latest version 3.7 and watch the error "NullReferenceException in LayoutAnchorableTabItem"

@XceedBoucherS

This comment has been minimized.

Copy link
Collaborator

XceedBoucherS commented Jan 9, 2019

Hi,
The v3.7 Plus version (free for 45 days) is only available on Xceed web site : https://xceed.com/xceed-toolkit-plus-for-wpf/
If this is the version you tested with the issue, can you explain in details your steps to reproduce the issue and give us the sample code you used.
Thank you.

@snooka2197

This comment has been minimized.

Copy link

snooka2197 commented Jan 10, 2019

This is already fixed in v3.5 and up with the check " _draggingItem != null".

Any ETA when v3.5 (non Plus version) is available?

@JobaDiniz

This comment has been minimized.

Copy link

JobaDiniz commented Jan 17, 2019

This is already fixed in v3.5 and up with the check " _draggingItem != null".

Any ETA when v3.5 (non Plus version) is available?

I don't understand wpftoolkit patches releases... this fix should be out there, it's been 6 months :(

@dgosbell

This comment has been minimized.

Copy link

dgosbell commented Jan 22, 2019

So is a new release due our soon? Or do I need to either rollback to 3.3 or fork the repo and fix this myself?

@JobaDiniz

This comment has been minimized.

Copy link

JobaDiniz commented Jan 22, 2019

or fork the repo and fix this myself?

I did just that... the only thing that is needed is if (_draggingItem != null ...) and bug goes away

@XceedBoucherS

This comment has been minimized.

Copy link
Collaborator

XceedBoucherS commented Feb 5, 2019

Hi,
v3.5 free version should be released in the next few days.
Thank you.

@dgosbell

This comment has been minimized.

Copy link

dgosbell commented Feb 5, 2019

Thanks for the update @XceedBoucherS this is great news :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment