Hi!
We use the document manager with the dock manager in our forms. In production, it happens sometimes that users are able to create an unhandled exception "Reference not set to an instance of an object." when they drag documents. Here is the stack trace :
DevExpress.XtraBars.Docking2010.Dragging.DocumentManagerUIViewRegularDragListener.OnDrop(Point point, ILayoutElement element)
DevExpress.XtraBars.Docking2010.DragEngine.DragServiceState.DoDrop(IUIView view, Point point, OperationType type)
DevExpress.XtraBars.Docking2010.DragEngine.DockingDragServiceState.ProcessMouseUp(IUIView view, Point point)
DevExpress.XtraBars.Docking2010.DragEngine.DragService.ProcessMouseCore(IUIView processor, Point screenPoint, MouseEventType eventType, MouseEventArgs e)
DevExpress.XtraBars.Docking2010.DragEngine.DragService.ProcessMouseOverride(IUIView view, MouseEventType eventType, MouseEventArgs ea)
DevExpress.XtraBars.Docking2010.DragEngine.UIService.ProcessMouse(IUIView view, MouseEventType eventType, MouseEventArgs ea)
DevExpress.XtraBars.Docking2010.DragEngine.UIViewAdapter.ProcessMouseEvent(IUIView view, MouseEventType eventType, MouseEventArgs ea)
DevExpress.XtraBars.Docking2010.DragEngine.MouseEventSubscriber`1.RootUIElementMouseUp(Object sender, MouseEventArgs e)
System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e)
System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
System.Windows.Forms.Control.WndProc(Message& m)
DevExpress.XtraBars.Docking2010.DocumentsHost.WndProc(Message& m)
System.Windows.Forms.Control+ControlNativeWindow.OnMessage(Message& m)
System.Windows.Forms.Control+ControlNativeWindow.WndProc(Message& m)
System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Unfortunately, we are unable to reproduce it at will. I send you the stack trace in case you could understand what is happening. It happens enough often to bother users and it is hard to tell them we cannot do anything for that.
Thanks!
Benoit
Hi Benoit,
While we can't reproduce this issue on our side as well, we checked this call stack and see some places we can improve. Though I can't guarantee that this will resolve the issue, but request a hotfix for this ticket and test it on your side. Let me know your results.
I hope the hotfix below fixes the issue, I'm not sure how to reproduce this myself but I got this in a few times from users. Thankfully the exception system takes screens of all the active forms so I can at least show what appears to be happening. I also cannot reproduce this at all, and the screen shown in this image is using both a document manager for the charts and a dock manager for many toolboxes used to manipulate the data surrounding the chart. In this case I'm not sure if the dock was initiated by the dock control or the document manager but I do have the exception. Hope this helps!
System.NullReferenceException: Object reference not set to an instance of an object.
at DevExpress.XtraBars.Docking2010.Dragging.DocumentManagerUIViewRegularDragListener.OnDrop(Point point, ILayoutElement element)
at DevExpress.XtraBars.Docking2010.DragEngine.DragServiceState.DoDrop(IUIView view, Point point, OperationType type)
at DevExpress.XtraBars.Docking2010.DragEngine.FloatingMovingDragServiceState.ProcessMouseUp(IUIView view, Point point)
at DevExpress.XtraBars.Docking2010.DragEngine.DragService.ProcessMouseCore(IUIView processor, Point screenPoint, MouseEventType eventType, MouseEventArgs e)
at DevExpress.XtraBars.Docking2010.DragEngine.DragService.ProcessMouseOverride(IUIView view, MouseEventType eventType, MouseEventArgs ea)
at DevExpress.XtraBars.Docking2010.DragEngine.UIService.ProcessMouse(IUIView view, MouseEventType eventType, MouseEventArgs ea)
at DevExpress.XtraBars.Docking2010.DragEngine.UIViewAdapter.ProcessMouseEvent(IUIView view, MouseEventType eventType, MouseEventArgs ea)
at DevExpress.XtraBars.Docking2010.Dragging.BaseFloatFormUIView.EndExternalDragging(Point screenPoint)
at DevExpress.XtraBars.Docking2010.Views.FloatDocumentCollection.<>c__DisplayClass2.<EndDragging>b__0()
at DevExpress.XtraBars.Docking2010.Views.FloatDocumentCollection.EndDragging(Form form, Point screenPoint)
at DevExpress.XtraBars.Docking2010.Views.FloatDocumentCollection.ProcessDragging(dragging action, Form form)
at DevExpress.XtraBars.Docking2010.Views.FloatDocumentCollection.ProcessWindowDragging(Int32 Msg, Form floatForm)
at DevExpress.XtraBars.Docking2010.Views.FloatDocumentCollection.PreFilterMessageCore(Int32 Msg, Control wnd, IntPtr HWnd, IntPtr WParam, IntPtr LParam)
at DevExpress.XtraBars.Docking2010.Views.BaseDocumentCollection.DevExpress.Utils.Win.Hook.IHookController.InternalPreFilterMessage(Int32 Msg, Control wnd, IntPtr HWnd, IntPtr WParam, IntPtr LParam)
at DevExpress.Utils.Win.Hook.HookManager.InternalPreFilterMessage(HookInfo hInfo, Int32 Msg, Control wnd, IntPtr HWnd, IntPtr WParam, IntPtr LParam)
at DevExpress.Utils.Win.Hook.HookManager.MouseHook(Int32 ncode, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Form.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmSysCommand(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at DevExpress.XtraEditors.XtraForm.WndProc(Message& msg)
at DevExpress.XtraBars.Ribbon.RibbonForm.WndProc(Message& msg)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Hi Chris,
We introduced changes in our code without reproducing this issue on our side. But I don't see what may be the cause of the issue based on the provided screenshot. If this fix does not work for you, handle the AppDomain.UnhandledException event in the following way:
[STAThread] static void Main() { Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
The Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); line is important. In the UnhandledException event handler, display a message to a user to collect a dump file for the error. For example:
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { MessageBox.Show("Collect Dump"); }
Once a user sees this message, ask them to collect a dump file. They can do this in the Task Manager as described in the How to create a user-mode process dump file in Windows Vista and in Windows 7 article. Once the dump file is obtained, ask your user to provide you with that file and then send it to us for research.