AD
Administrator
Syncfusion Team
December 1, 2006 09:43 PM UTC
Sorry, false alarm, it looks like I don't even get to LoadDockState because of the NullReferenceException in the SetEnableDocking(Control, bool) method:
public void RemoveViewer(Control c)
{
if (!DockingManager.GetEnableDocking(c)) throw new Exception("No such control in this view."); // returns false, continue execution
DockingManager.SetEnableDocking(c, false); // NullReferenceException here
}
I'll try to reproduce this issue now.
AD
Administrator
Syncfusion Team
December 5, 2006 06:23 PM UTC
While trying to reproduce this bug, I've found another one. In the attached example, SDI's panel1 is still docked, even though the call to dockingManager.SetEnableDocking(panel1, false) was made after InitializeComponent().
ClosingFloatingWindow0.zip
MU
Murugan
Syncfusion Team
December 5, 2006 06:44 PM UTC
Hi Andrew,
Docking related operations has to be done after the form_load event.Because at that time, docking manager is not yet initialized. So it is to be done in DockingManager.NewDockStateEndLoad event. Please refer the below KB article for more details.
Is the Form.Load event handler a good place to perform custom initialization of the docking layout?
Please let me know if you need further assistance.
Thanks for using Syncfusion products.
Regards,
Murugan P.S
AD
Administrator
Syncfusion Team
December 5, 2006 09:02 PM UTC
Ooops, that's a bummer. I wonder why did you decide to make this restriction? It used to work fine prior to 4.4 version. Actually, now it's quite a problem for us because we do lots of docking-related things in form's deserialization constructor (our SDI forms are serializable) :'( Moving this code out of constructor is a non-trivial task.
MU
Murugan
Syncfusion Team
December 6, 2006 12:01 AM UTC
Hi Andrew,
This restriction is there in previous versions also. Could you please provide your Essential Studio version that you have been using?. This will help us to check the issue in that version and go further analysis.
Thanks,
Murugan P.S
AD
Administrator
Syncfusion Team
December 6, 2006 12:32 AM UTC
We used 4.2.0.37 prior to 4.4. We definitely extensively used dockingManager before the Load event (at least for a couple of years :))
Now I modified the code in such a way that it doesn't access dockingManager before the Load event fires. Still, we're getting NullReferenceException and IndexOutOfBoundsException left and right in SF libraries :(
For instance, when the SDI form is closed, I get the following exception:
> Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.DockHost.OnPaint(System.Windows.Forms.PaintEventArgs e = {ClipRectangle = {X=0,Y=0,Width=552,Height=468}}) Line 4285 + 0x15 bytes C#
[External Code]
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.DockHost.WndProc(ref System.Windows.Forms.Message msg = {msg=0xf (WM_PAINT) hwnd=0x60eb0 wparam=0x0 lparam=0x0 result=0x0}) Line 4452 + 0xb bytes C#
[External Code]
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.MainFormController.AdjustLayout() Line 988 + 0xd bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.MainFormController.LayoutRect.set(System.Drawing.Rectangle value = {X = 0 Y = 64 Width = 1265 Height = 961}) Line 116 + 0xa bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.MainFormController.AdjustLayoutDockArea() Line 1148 + 0x22 bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.MainFormController.ChildControl_SizeChanged(object sender = {Syncfusion.Windows.Forms.Tools.XPMenus.CommandDockBarExt}, System.EventArgs e = {System.EventArgs}) Line 428 + 0xb bytes C#
[External Code]
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.CommandDockBar.OnSizeChanged(System.EventArgs e = {System.EventArgs}) Line 983 + 0x9 bytes C#
[External Code]
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.XPMenus.CommandDockBarExt.WndProc(ref System.Windows.Forms.Message m = {msg=0x47 (WM_WINDOWPOSCHANGED) hwnd=0x450cb8 wparam=0x0 lparam=0x12dc64 result=0x0}) Line 252 + 0x9 bytes C#
[External Code]
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.CommandDockBar.SetBoundsCore(int x = 0, int y = 0, int width = 1265, int height = 64, System.Windows.Forms.BoundsSpecified specified = Width | Height) Line 1014 + 0x17 bytes C#
[External Code]
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.CommandDockBar.CalcDockbarSize() Line 884 + 0x42 bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.CommandDockBar.RemoveCommandBar(Syncfusion.Windows.Forms.Tools.CommandBar cbar = {Syncfusion.Windows.Forms.Tools.XPMenus.CommandBarExt}) Line 471 + 0x7 bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.CommandBarController.ApplyDeserializedState(System.Collections.IEnumerator ebarlist = {System.Collections.ArrayList.ArrayListEnumeratorSimple}) Line 1153 + 0x19 bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.CommandBarController.FreezeLayout.set(bool value = false) Line 649 + 0x1c bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.XPMenus.CommandBarManager.UnLockBars() Line 622 + 0xc bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.LatestActiveMdiChild.set(System.Windows.Forms.Form value = null) Line 322 + 0xa bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.OnMdiChildRemoved(System.Windows.Forms.Form childForm = {Jnj.ThirdDimension.Explorer.View, Text: SAR}, bool fromClose = true) Line 2092 + 0xa bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.XPMenus.MainFrameBarManager.OnFormClosed(System.Windows.Forms.Form form = {Jnj.ThirdDimension.Explorer.View, Text: SAR}) Line 3354 + 0xb bytes C#
Syncfusion.Tools.Windows.dll!Syncfusion.Windows.Forms.Tools.XPMenus.BarManager.FormClosed(object sender = {Jnj.ThirdDimension.Explorer.View, Text: SAR}, System.EventArgs e = {System.Windows.Forms.FormClosedEventArgs}) Line 6064 + 0x19 bytes C#
[External Code]
ThirdDimension.Explorer.dll!Jnj.ThirdDimension.Explorer.View.OnClosed(System.EventArgs e = {System.Windows.Forms.FormClosedEventArgs}) Line 2527 + 0xb bytes C#
AD
Administrator
Syncfusion Team
December 6, 2006 12:35 AM UTC
I forgot to mention that was an ArgumentOutOfRangeException, 'Index 0 is out of range.':
ProvideGraphicsItemsEventArgs pgargs = new ProvideGraphicsItemsEventArgs(
Controls[0], // here dcInternal.DockingManager.Renderer.CaptionBounds,
captionState == CaptionState.Active );
MU
Murugan
Syncfusion Team
December 7, 2006 12:37 AM UTC
Hi Andrew,
We really regret for the inconvenience caused. We are looking into this. We will update the details tomorrow.
Thanks for your patience.
Regards,
Murugan P.S
MU
Murugan
Syncfusion Team
December 7, 2006 04:54 PM UTC
Hi Andrew,
Could you please send me the sample having the issue?. This will help us to analyse the issue further.
Thanks for your patience.
Regards,
Murugan P.S
AD
Administrator
Syncfusion Team
December 7, 2006 08:23 PM UTC
The problem is that I couldn't reproduce this bug in a simple app, although I'm still trying. Our product is a quite complex plugin-enabled MDI application, with menus/toolbars/viewers being dynamically added at runtime.
Is there anything else I can possibly do in order to track this bug down?
MU
Murugan
Syncfusion Team
December 8, 2006 11:56 PM UTC
Hi Andrew,
Could you please provide me the cs file having form_load event code and if possible provide me reproducing steps?. This will help us to analyse the issue further.
Thanks,
Murugan P.S
AD
Administrator
Syncfusion Team
December 11, 2006 06:42 PM UTC
Here's an update: I get this exception only when the last child form is closed. So if I open 3 views, close any 2 of them (order is irrelevant), it will still work fine. Exception will occur only when I close the last one.
I'm removing the irrelevant stuff from the .cs file and will post it here soon.
Thanks!
Andrew
AD
Administrator
Syncfusion Team
December 11, 2006 08:55 PM UTC
Well I finally managed to reproduce it and found a workaround :) It looks like now DockingManager is subscribing to the docked control's Disposed event; when handling this event, it removes the control from docking manager's Controls collection (I'm not 100% sure about it, that's just deduction). Later in the DockHost.OnPaint method, you access Controls[0] and at that time the Controls collection is empty.
In our code, we override OnClosed method, process docked controls and then dispose them. The simplified code looks like that:
protected override void OnClosed(EventArgs e)
{
foreach (Control c in dockingManager1.ControlsArray)
{
c.Dispose();
}
base.OnClosed(e);
}
If we move the "foreach" block after the base.OnClosed(e) call, the problem goes away. Well, almost goes away, since it breaks the logic of our code, but at least now we are able to work around this bug.
Attached is an example demonstrating the problem. Simply add a view (View->New) and close it.
ClosingFloatingWindow2.zip
MU
Murugan
Syncfusion Team
December 11, 2006 10:34 PM UTC
Hi Andrew,
Thanks for your sample. We are glad to hear that the problem is solved by your workarounds. I am afraid, still we were not able to reproduce the issue here. Herewith I have attached the video file that shows my testing process. Please refer the video and let me know if i have missed something in reprocducing the issue.
TestingProcess
Regards,
Murugan P.S
AD
Administrator
Syncfusion Team
December 12, 2006 09:16 PM UTC
Hi Murugan,
Yes, it turned out that it works correctly with the 4.4.0.51 version. Our mistake was that we tested it against the 4.4.0.46 version. One guy in our team tried the new 4.4.0.51 version when it came out, got the same exception (I believe it was because we were accessing DockingManager before the Load event), that's why we decided not to upgrade at that point.
I'm sorry that you wasted your time trying to help us, of course we should have upgraded to the latest version.
Thanks for the great support!
-Andrew
MU
Murugan
Syncfusion Team
December 12, 2006 11:00 PM UTC
Hi Andrew,
We are glad to hear that the issue has been resolved in latest version v4.4.
Thanks for using Syncfusion support.
Regards,
Murugan P.S