Resize event causes Stackoverflow exception

Docking/MDI for Windows Forms Forum

Posted 14 years ago by Lee Grissom - Quest Software, Inc.
Version: 2.0.0109
Platform: .NET 3.5
Environment: Windows XP (32-bit)
Avatar
We noticed a newly observed bug in our application. Essentially, our application is crashing with a unrecoverable Stackoverflow Exception. The call stack made me believe that it was a bug in DevExpress controls, but after opening a case with them, they are convinced that the true bug is in Actipro's code. They believe that what we're observing is merely a catalyst for a defect in the Actipro Docking code.

Here is the link to the full report (PLEASE read it, it's short):
http://www.devexpress.com/Support/Center/p/Q258344.aspx


Here is the call stack before things spin out of control (bottom is the entry point):

... this last block repeats over and over unknown number of times until this line here finally blows up with StackOverflow exception.
DevExpress.Utils.v9.3.dll!DevExpress.Skins.XtraForm.FormPainter.GetCaptionClient(System.Drawing.Rectangle captionBounds) Line 709    C#
DevExpress.Utils.v9.3.dll!DevExpress.Skins.XtraForm.FormPainter.CheckReady() Line 197    C#
DevExpress.Utils.v9.3.dll!DevExpress.Skins.XtraForm.FormPainter.Margins.get() Line 2009    C#
DevExpress.Utils.v9.3.dll!DevExpress.Skins.XtraForm.FormPainter.CalcSizeFromClientSize(System.Drawing.Size client) Line 153 + 0x14 bytes    C#
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.SizeFromClientSize(System.Drawing.Size clientSize) Line 789 + 0x18 bytes    C#
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.CreateHandle() Line 182 + 0x20 bytes    C#
System.Windows.Forms.dll!System.Windows.Forms.Control.Handle.get() + 0x45 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.RectangleToScreen(System.Drawing.Rectangle r) + 0x45 bytes    
ActiproSoftware.UIStudio.Dock.Net20.dll!ActiproSoftware.UIStudio.Dock.DockManager.a(bool A_0 = true) + 0x3d5 bytes    
ActiproSoftware.UIStudio.Dock.Net20.dll!ActiproSoftware.UIStudio.Dock.DockManager.j() + 0x5e9 bytes    
ActiproSoftware.UIStudio.Dock.Net20.dll!ActiproSoftware.UIStudio.Dock.DockManager.t(object A_0 = {Quest.Toad.Gui.MainForm}, System.EventArgs A_1 = {System.EventArgs}) + 0x24 bytes    
[Native to Managed Transition]    
[Managed to Native Transition]    
System.Windows.Forms.dll!System.Windows.Forms.Control.OnResize(System.EventArgs e) + 0xbb bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.OnResize(System.EventArgs e) + 0xd bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.OnSizeChanged(System.EventArgs e = {System.EventArgs}) + 0x29 bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.OnSizeChanged(System.EventArgs e) Line 595    C#
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x, int y, int width, int height, int clientWidth, int clientHeight) + 0x9c bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x, int y, int width, int height) + 0x82 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified = Width | Height) + 0xd7 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified) + 0x111 bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified) Line 722    C#
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBounds(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified) + 0x69 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.Size.set(System.Drawing.Size value) + 0x17 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.Size.set(System.Drawing.Size value) + 0xe bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.CreateHandle() Line 182 + 0x30 bytes    C#

System.Windows.Forms.dll!System.Windows.Forms.Control.Handle.get() + 0x45 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.RectangleToScreen(System.Drawing.Rectangle r) + 0x45 bytes    
ActiproSoftware.UIStudio.Dock.Net20.dll!ActiproSoftware.UIStudio.Dock.DockManager.a(bool A_0 = true) + 0x3d5 bytes    
ActiproSoftware.UIStudio.Dock.Net20.dll!ActiproSoftware.UIStudio.Dock.DockManager.j() + 0x5e9 bytes    
ActiproSoftware.UIStudio.Dock.Net20.dll!ActiproSoftware.UIStudio.Dock.DockManager.t(object A_0 = {Quest.Toad.Gui.MainForm}, System.EventArgs A_1 = {System.EventArgs}) + 0x24 bytes    
[Native to Managed Transition]    
[Managed to Native Transition]    
System.Windows.Forms.dll!System.Windows.Forms.Control.OnResize(System.EventArgs e) + 0xbb bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.OnResize(System.EventArgs e) + 0xd bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.OnSizeChanged(System.EventArgs e = {System.EventArgs}) + 0x29 bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.OnSizeChanged(System.EventArgs e) Line 595    C#
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x, int y, int width, int height, int clientWidth, int clientHeight) + 0x9c bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.UpdateBounds(int x, int y, int width, int height) + 0x82 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified = Width | Height) + 0xd7 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified) + 0x111 bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.SetBoundsCore(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified) Line 722    C#
System.Windows.Forms.dll!System.Windows.Forms.Control.SetBounds(int x, int y, int width, int height, System.Windows.Forms.BoundsSpecified specified) + 0x69 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.Size.set(System.Drawing.Size value) + 0x17 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.Size.set(System.Drawing.Size value) + 0xe bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.CreateHandle() Line 182 + 0x30 bytes    C#

System.Windows.Forms.dll!System.Windows.Forms.Control.RecreateHandleCore() + 0x156 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Form.RecreateHandleCore() + 0x195 bytes    
System.Windows.Forms.dll!System.Windows.Forms.Control.RecreateHandle() + 0xb bytes    
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.CheckUpdateSkinPainter() Line 137 + 0x8 bytes    C#
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.OnLookAndFeelChangedCore() Line 488    C#
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.CheckForceLookAndFeelChangedCore() Line 65 + 0x7 bytes    C#
DevExpress.Utils.v9.3.dll!DevExpress.XtraEditors.XtraForm.ResumeLayout(bool performLayout = true) Line 639    C#
DevExpress.Utils.v9.3.dll!DevExpress.LookAndFeel.Helpers.FormUserLookAndFeel.OnStyleChanged() Line 60 + 0x138 bytes    C#
DevExpress.Utils.v9.3.dll!DevExpress.LookAndFeel.UserLookAndFeel.OnParentStyleChanged(object sender, System.EventArgs e) Line 158    C#
DevExpress.Utils.v9.3.dll!DevExpress.LookAndFeel.UserLookAndFeel.EventRecord<System.__Canon>.Invoke(DevExpress.LookAndFeel.UserLookAndFeel userLookAndFeel, System.EventArgs eventArgs) Line 534    C#
DevExpress.Utils.v9.3.dll!DevExpress.LookAndFeel.UserLookAndFeel.OnStyleChanged() Line 174 + 0xe bytes    C#
DevExpress.Utils.v9.3.dll!DevExpress.LookAndFeel.UserLookAndFeelDefault.OnStyleChanged() Line 35    C#
DevExpress.Utils.v9.3.dll!DevExpress.LookAndFeel.UserLookAndFeel.Style.set(DevExpress.LookAndFeel.LookAndFeelStyle value) Line 472 + 0xf bytes    C#
To make this report easier to read, I've omitted the majority of the call stack, as it simply is just the same block of code repeating over and over,
from:
ActiproSoftware.UIStudio.Dock.DockManager.t()
to:
System.Windows.Forms.Control.OnResize()

Since the Actipro assemblies are obfuscated, and I don't have the source code to the Actipro Docking library, I can't perform a more in depth analysis on what might be causing the problem.

I suspect that the DockManager class isn't correctly protecting itself from Recursive calls to the "Resize" event. In other words, this could be a simple re-entrancy bug. What do you suggest for me to investigate further?

Comments (4)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Lee,

Our Form_Resize handler calls a method that calls a method that executes effectively Form.RectangleToScreen(). That call seems to be firing the XtraForm.CreateHandle method indirectly and causes the loop.

I would be interested to see if you could dupe this without our controls, and just using DevExpress ones. Then attach to your Form's Resize event and do a RectangleToScreen call. See if you can dupe it that way.


Actipro Software Support

Posted 14 years ago by Lee Grissom - Quest Software, Inc.
Avatar
No, that hooking into my Form's Resize event and calling RectangleToScreen didn't dupe it. It does do what we expected, it does call the XtraForm.CreateHandle() method... but it seems to be smart enough to not trigger another Resize event. I'm having a difficult time recreating this issue in a separate application... but I've posted my findings on DevExpress's forum under the same URL I provided previously.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Lee,

We have never run into this recusion here before so I would think due to some interaction with how they have altered handle creation on their XtraForm.

Anyhow I've added an IsHandleCreated check in our Form.Resize handler. If we give you a preview build, can you try it out and see if it resolves the issue? Please email our support email address if you'd like to try a preview.


Actipro Software Support

Posted 14 years ago by Lee Grissom - Quest Software, Inc.
Avatar
Your advice on hooking up the Resize event got me going in the right direction. I successfully reproduced the problem, and it's clearly in the DevExpress controls. It is not caused by Actipro. I attached a sample project to my report on their site. Thanks for your help.
The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.