- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.Scheduling library for HTML5 & JavaScript.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
LBC + RBC null ref exception
Read 326 times

lexeranddn   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
LBC + RBC null ref exception
Dec 4th, 2018 at 10:23am
 
we use context menu on Diagram to choose between select and pan mode, and if we clicking quickly LBC + RBC several times we can catch exception, stack trace the following

   at MindFusion.Diagramming.Wpf.Diagram.QS(MouseButtonEventArgs K, Point N)
   at MindFusion.Diagramming.Wpf.Diagram.OnPreviewMouseDown(MouseButtonEventArgs e)
   at System.Windows.UIElement.OnPreviewMouseDownThunk(Object sender, MouseButtonEventArgs e)
   at System.Windows.Input.MouseButtonEventArgs.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.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   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)
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1587
Gender: male
tech.support


   
     
 
Re: LBC + RBC null ref exception
Reply #1 - Dec 4th, 2018 at 12:19pm
 
Try calling diagram.CancelDrag() before showing the context menu. If it doesn't help, please post diagram initialization code and respective event handlers, or attach a test project reproducing that.
 
 
 
IP Logged    
 
     

lexeranddn   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
Re: LBC + RBC null ref exception
Reply #2 - Dec 5th, 2018 at 12:16pm
 
Looks like it helps, thanks!
 
 
 
IP Logged    
 
     

lexeranddn   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
Re: LBC + RBC null ref exception
Reply #3 - Dec 5th, 2018 at 1:31pm
 
I'm sorry, actually it does not work, before I try to make test example:
one more point to reproduce, we declare for diagram dependency property

        public object MenuItemIsCheckedPan
        {
            get => GetValue(MenuItemIsCheckedPanProperty);
            set => SetValue(MenuItemIsCheckedPanProperty, value);
        }

        public static readonly DependencyProperty MenuItemIsCheckedPanProperty =
            DependencyProperty.Register(nameof(MenuItemIsCheckedPan), typeof(object), typeof(StructureEditor),
                new PropertyMetadata(null));

and problem is reproducing when this property in true state.
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1587
Gender: male
tech.support


   
     
 
Re: LBC + RBC null ref exception
Reply #4 - Dec 6th, 2018 at 8:39am
 
And what does MenuItemIsCheckedPan do when enabled - does it set diagram.Behavior to Pan?
 
 
 
IP Logged    
 
     

lexeranddn   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
Re: LBC + RBC null ref exception
Reply #5 - Dec 6th, 2018 at 2:51pm
 
Yes, behaviour changes on MouseMove callback
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1587
Gender: male
tech.support


   
     
 
Re: LBC + RBC null ref exception
Reply #6 - Dec 6th, 2018 at 4:28pm
 
Have you also tried calling CancelDrag from that MouseMove callback?
 
 
 
IP Logged    
 
     

lexeranddn   Offline
YaBB Newbies
*
Posts: 8
I Love MindFusion!


   
     
 
Re: LBC + RBC null ref exception
Reply #7 - Dec 7th, 2018 at 10:49am
 
Great! That works!
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print