This is a migrated thread and some comments may be shown as answers.

DocumentManager.get_ActiveDocument() Exception

2 Answers 93 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Simon Maystre
Top achievements
Rank 1
Simon Maystre asked on 14 Mar 2011, 11:06 AM
I have a dock control with 6 minimized toolbar windows and all works as expected accept when a tabbed document it loaded into the MDI area and one of the toolbar windows is opened and a control within that toolbar window is clicked the following exception is thrown:

System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Telerik.WinControls.RadDock
  StackTrace:
       at Telerik.WinControls.UI.Docking.DocumentManager.get_ActiveDocument()
       at Telerik.WinControls.UI.Docking.DocumentManager.InsertDocument(Int32 index, DockWindow document)
       at Telerik.WinControls.UI.Docking.DocumentManager.EnsureActiveDocument()
       at Telerik.WinControls.UI.Docking.DocumentManager.get_ActiveDocument()
       at Telerik.WinControls.UI.Docking.DocumentManager.OnActiveWindowChanged(DockWindow currActive)
       at Telerik.WinControls.UI.Docking.RadDock.OnActiveWindowChanged(DockWindowEventArgs e)
       at Telerik.WinControls.UI.Docking.RadDock.UpdateActiveWindow(DockWindow window, Boolean forceNotify)
       at Telerik.WinControls.UI.Docking.RadDock.ActivateWindow(DockWindow window, Boolean forceNotify)
       at Telerik.WinControls.UI.Docking.RadDock.set_ActiveWindow(DockWindow value)
       at Telerik.WinControls.UI.Docking.DockWindow.OnEnter(EventArgs e)
       at System.Windows.Forms.Control.NotifyEnter()
       at System.Windows.Forms.ContainerControl.UpdateFocusedControl()
       at System.Windows.Forms.ContainerControl.AssignActiveControlInternal(Control value)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control, Boolean originator)
       at System.Windows.Forms.ContainerControl.ActivateControlInternal(Control control)
       at System.Windows.Forms.Control.WmSetFocus(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.SetFocus(HandleRef hWnd)
       at System.Windows.Forms.Control.FocusInternal()
       at System.Windows.Forms.Control.Focus()
       at Telerik.WinControls.RadControl.ProcessFocusRequested(RadElement element)
       at Telerik.WinControls.RadControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at PCNManager.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException:

Any assistance would be appreciated.

Thanks

Simon

2 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 17 Mar 2011, 10:34 AM
Hello Simon Maystre,

We can not reproduce the reported exception. Therefore, please send us a simple application with your scenario to investigate the issue locally and find best solution for your application.

Best wishes,
Julian Benkov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Simon Maystre
Top achievements
Rank 1
answered on 21 Mar 2011, 10:45 AM
Julian,

Thanks for the reply... I have found out what was causing the problem. I was adding controls directly to the DocumentContainer object of RadDock (i.e tab controls and pictureboxes) rather than creating a form in code then adding the controls to that form to then add the form to the MDIParent. Once I did this all is OK but thanks for looking into this.

Simon
Tags
Dock
Asked by
Simon Maystre
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Simon Maystre
Top achievements
Rank 1
Share this question
or