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

Closing last window with middle clicking the document tab throws an exception

4 Answers 148 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Constantinos Petridis asked on 05 Mar 2012, 05:21 PM
Good afternoon Telerik team :)

I've been testing the new version of Telerik's RadDock control (2012 Q1) and I seem to have found a problem when closing the last document by middle clicking its tab.

An Unhandled null reference exception is thrown with the following stack trace:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.


************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
   at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)




************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.239 (RTMGDR.030319-2300)
    CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
RadDockPRoblem
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Projects/RadDockProblem/bin/Debug/RadDockPRoblem.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.235 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 built by: RTMRel
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.232 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.225 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
Telerik.WinControls.UI
    Assembly Version: 2012.1.12.215
    Win32 Version: 2012.1.12.0215
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls.UI/2012.1.12.215__5bb2a467cbec794e/Telerik.WinControls.UI.dll
----------------------------------------
Telerik.WinControls.RadDock
    Assembly Version: 2012.1.12.215
    Win32 Version: 2012.1.12.0215
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls.RadDock/2012.1.12.215__5bb2a467cbec794e/Telerik.WinControls.RadDock.dll
----------------------------------------
Telerik.WinControls
    Assembly Version: 2012.1.12.215
    Win32 Version: 2012.1.12.0215
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls/2012.1.12.215__5bb2a467cbec794e/Telerik.WinControls.dll
----------------------------------------
TelerikCommon
    Assembly Version: 2012.1.12.215
    Win32 Version: 2012.1.12.0215
    CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/TelerikCommon/2012.1.12.215__5bb2a467cbec794e/TelerikCommon.dll
----------------------------------------
al30nzul
    Assembly Version: 2012.1.12.215
    Win32 Version: 4.0.30319.232 built by: RTMGDR
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------


************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.


For example:


<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>


When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

All other ways of closing a document seem to work just fine (ctrl-F4, close button on tab, close button on document's tab strip, selecting close or close all by right clicking the tab etc). If you try to perform this action while Designing the form (in VS2010), the instance of Visual Studio will close without warning.

I am attaching a sample project, just compile & run and try to close the document window by middle clicking on the window's tab header.
I was trying to find a way to disable this functionality (close window by middle clicking the document's tab) but I could not find any, do you have any suggestions?

4 Answers, 1 is accepted

Sort by
0
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
answered on 06 Mar 2012, 04:33 PM
I issued a support ticket for this problem but I think I found a workaround that seems to work until a fix is introduced by Telerik.
After seeing the actual source code of Telerik.WinControls.ComponentInputBehavior.OnMouseUp function, I tried to set the DisableMouseEvents of the Behavior Object in DockWindow.DockTabStrip to true for the last document in the closing documents DockTabStrip. This is the code snippet.

private void radDock1_DockWindowClosing(object sender, Telerik.WinControls.UI.Docking.DockWindowCancelEventArgs e)
{
      if (e.NewWindow.DockTabStrip.TabPanels.Count == 1)
          e.NewWindow.DockTabStrip.Behavior.DisableMouseEvents = true;
}

Disabling the mouse events for DockTabStrip will skip the execution of code that generates the unhandled null reference exception. I just hope that this does not introduce a problem somewhere else in the docking mechanism.
0
Accepted
Boryana
Telerik team
answered on 07 Mar 2012, 12:24 PM
Hi Constantinos,

Thank you for the detailed explanation and the sample project. They were of great help.

I confirm that there is an issue with closing the last TabbedDocument using middle click. I have logged it in our Public Issue Tracker under ID 10076. To vote for it and subscribe for its stats updates please follow this link: http://www.telerik.com/support/pits.aspx#/public/winforms/10076

Currently, the only workaround is subscribe to the DocumentTabStrip MouseClick event and raise a flag if the used button is middle. Further, you can cancel the document closing in DockWindowClosing even handler depending on the flag's value. For example: 
public Form1()
{
    InitializeComponent();
    this.radDock1.DockWindowClosing += new DockWindowCancelEventHandler(radDock1_DockWindowClosing);
    DocumentTabStrip a = this.radDock1.GetDefaultDocumentTabStrip(false);
    a.MouseClick += new MouseEventHandler(a_MouseClick);
}
 
void radDock1_DockWindowClosing(object sender, DockWindowCancelEventArgs e)
{
    if (middleClick)
    {
        e.Cancel = true;
        middleClick = false;
    }
}
 
void a_MouseClick(object sender, MouseEventArgs e)
{
    if (e.Button == System.Windows.Forms.MouseButtons.Middle)
    {
        middleClick = true;
    }
}

Thank you for reporting this issue and please excuse us for the caused inconvenience. Our team will do its best to address the issue in a future release. Your Telerik points have been updated for this report.

Regards,
Boryana
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
daouddajani
Top achievements
Rank 1
answered on 17 Jul 2012, 02:59 PM
I have the same problem when i close the winform by double click on a radGrid row
my application allows me to double click a radgrid row to choose it then closes the windows and places the value in the parent window.

after i upgraded to Q1 2012 the problem started and even in Q2 2012 its the same.

any help please


System.NullReferenceException was unhandled
  Message=Object reference not set to an instance of an object.
  Source=Telerik.WinControls
  StackTrace:
       at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
       at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
       at Telerik.WinControls.UI.RadGridView.OnMouseUp(MouseEventArgs e)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       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.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr 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 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at SalesForce2011.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
  InnerException:
0
Boryana
Telerik team
answered on 19 Jul 2012, 01:33 PM
Hello,

Thank you for writing.

My attempts to reproduce the issue you experience were not successful. Would you please share your specific implementation through pasting code snippets? Alternatively, you can open a new support ticket and attach your project there. Once I am able to replicate the exception on my side I will do my best to provide you with proper support.

I am looking forward to your reply.

All the best,
Boryana
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Dock
Asked by
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Answers by
Constantinos Petridis
Top achievements
Rank 1
Iron
Iron
Boryana
Telerik team
daouddajani
Top achievements
Rank 1
Share this question
or