Grids changed in latest source? RenderException

Aug 25, 2010 at 9:42 AM
Edited Aug 25, 2010 at 9:50 AM


I've updated to the latest source so I can start playing with the ListViews. Seems ok, but I've got a problem on one screen where I use a grid. Nothing has changed since I was using Beta3 (where it worked) but now when the screen draws I get the following error:


RenderException was unhandled.


Looking down the exception tree I have these:

RenderControl.PreLoad > Specified argument was out of the range of valid values.\r\nParameter name: Parent must be null.


Stack trace:

   at Silvermoon.Controls.Base.ControlCollection.CheckParentParent(Control control)   at Silvermoon.Controls.Base.ControlCollection.AddFirst(Control control)   at Silvermoon.Controls.Grid.LayoutWithTransition()   at Silvermoon.Controls.Grid.LayoutGrid()   at Silvermoon.Controls.Grid.OnLayout()   at Silvermoon.Controls.Control.PreLoad()   at Silvermoon.Controls.Control.PreLoad()   at Silvermoon.Controls.Control.PreLoad()   at Silvermoon.Core.Renderer.RenderControl(Control control)   at Silvermoon.Core.Renderer.RenderControls(ControlCollection controls)   at Silvermoon.Core.Renderer.Render(ControlCollection controls)   at Silvermoon.Core.Screen.Update()   at Silvermoon.Core.TimeEventServer.Progress()   at Silvermoon.Core.TimeEventServer.OnEventTick(Object sender, EventArgs e)   at System.Windows.Forms.Timer._WnProc(WM wm, Int32 wParam, Int32 lParam)   at System.Windows.Forms.ApplicationThreadContext._InternalContextMessages(WM wm, Int32 wParam, Int32 lParam)   at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)   at System.Windows.Forms.Application.Run(Form fm)   at Program.Main()


So, it looks like my grid is not laying out properly (indeed, some other controls at the top of the screen are already drawn and visible when the exception occurs. Any thoughts as to what I need to change?





Aug 25, 2010 at 1:15 PM
Edited Aug 25, 2010 at 9:09 PM


I maybe got the same problem, although I'm not getting the 'RenderException not handled' error. Unfortunatelly this is not exactly reproducable, but here are some things that might help:

I've got a Grid with several controls. A some time while using the application, some text  or parts of a control or complete controls are missing. The application is fully useable, just that there is something missing. This occurs in both the Debug configuration, where DEBUG is set, and in Release configuration, where DEBUG is not set. Sometimes I also get the 'RenderException not handled' error, but only if DEBUG is set. This is at line 198 in Renderer.cs.




edit: ok, these two things don't seem to be connected, so I'm going to open a new issue item for the vanishing controls.

Aug 26, 2010 at 12:04 AM

This exception only happens in debug mode.

In this case it was caused by the Grid as it uses ControllCollection.ClearQuick() which does not remove the parent from each control in the collection. The grid would then add the controls again to the collection. Anyway, I changed this for the next change set.