Rank: Advanced Member Groups: Member
Joined: 3/23/2010 Posts: 35
|
Hello, We are facing a problem that simply having a eo:Menu control in a page is forcing other controls to perform data binding, even if eo:Menu is in a separate .ascx file. Aside from performance implications, this actually crashes the site when an asynchronous datasource is being used for binding ( Page.RegisterAsyncTask) with "There are registered asynchronous tasks that were never executed during the page processing." exception. Stack trace when data binding (which in turn registers async tasks) is forced by EO menu control:
Code: C#
System.Web.dll!System.Web.UI.WebControls.DataBoundControl.PerformSelect() + 0x105 bytes
System.Web.dll!System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() + 0x52 bytes
System.Web.dll!System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() + 0x5f bytes
System.Web.dll!System.Web.UI.Control.EnsureChildControls() + 0x92 bytes
System.Web.dll!System.Web.UI.WebControls.CompositeDataBoundControl.Controls.get() + 0x14 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x94 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Collections.Hashtable A_1, System.Type A_2, bool A_3) + 0x1c3 bytes
EO.Web.DLL!EO.Web.Internal.bd.a(System.Web.UI.Control A_0, System.Type A_1, bool A_2) + 0x3e bytes
EO.Web.DLL!EO.Web.CustomItem.a(System.Web.UI.Control A_0) + 0x47 bytes
xt34zyv-!EO.Web.Internal.im.a(System.Web.UI.Control A_0, System.Web.UI.HtmlTextWriter A_1) + 0x6a bytes
xt34zyv-!EO.Web.Internal.im.b(System.Web.UI.Control A_0, System.Web.UI.HtmlTextWriter A_1) + 0xeb bytes
xt34zyv-!EO.Web.Internal.im.c(System.Web.UI.Control A_0, System.Web.UI.HtmlTextWriter A_1) + 0x11e bytes
xt34zyv-!EO.Web.Internal.o.a(System.Web.UI.HtmlTextWriter A_0) + 0x62 bytes
EO.Web.DLL!EO.Web.BaseNavigator.a(System.Web.UI.HtmlTextWriter A_0) + 0x531 bytes
EO.Web.DLL!EO.Web.WebControlBase.n(System.Web.UI.HtmlTextWriter A_0) + 0x85 bytes
EO.Web.DLL!EO.Web.WebControlBase.Render(System.Web.UI.HtmlTextWriter writer) + 0xc9 bytes
App_Web_tree.ascx.2c7de285.uqlpdoao.dll!ASP.resources_webcontrols_projectwise_tree_ascx.__Render__control1(System.Web.UI.HtmlTextWriter __w = {System.Web.UI.HtmlTextWriter}, System.Web.UI.Control parameterContainer = {ASP.resources_webcontrols_projectwise_tree_ascx}) + 0x1bf bytes C#
Here is the code to reproduce the problem. I have added a handler for DataBinding event for a control that's invisible to throw an exception if data binding is attempted. Exception is not being thrown if eo:Menu control is removed.
Code: HTML/ASPX
<%@ Page Language="C#" %>
<%@ Register Assembly="EO.Web" Namespace="EO.Web" TagPrefix="eo" %>
<script runat="server">
void Grid2_DataBinding (object sender, EventArgs e)
{
throw new InvalidOperationException ();
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
</head>
<body>
<form runat="server">
<asp:XmlDataSource runat="server" ID="datasource1">
<Data>
<Root>
<Item attr="val1">1</Item>
<Item attr="val2">2</Item>
</Root>
</Data>
</asp:XmlDataSource>
<asp:GridView ID="grid1" runat="server" DataSourceID="datasource1" />
<asp:XmlDataSource runat="server" ID="datasource2">
<Data>
<Root>
<Item attr="val3">3</Item>
<Item attr="val4">4</Item>
</Root>
</Data>
</asp:XmlDataSource>
<asp:GridView ID="grid2" runat="server" DataSourceID="datasource2" Visible="false" OnDataBinding="Grid2_DataBinding" />
<eo:Menu runat="server" />
</form>
</body>
</html>
Thanks, Laurynas
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
That's a very interesting scenario. I can not see any way to avoid the data binding though. As soon as you have the control in the page and have its data source set, then it will perform data binding sooner or later. The reason that it gets triggered by the menu is because the menu would look for CustomItem controls in the page. In order to do that, it would walk the whole control tree for the page, which triggers implicit data binding. However even if we do not walk the control, the page's rendering process will still walk the control tree. So anyway all the implicit data binding will be triggered right?
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 3/23/2010 Posts: 35
|
The problem is that with Menu control in page, it data binds even controls that have Visible property set to false (or when any of their parent controls has Visible set to false). Without Menu in the page it does not happen. And when an invisible control is being data bound to an asynchronous datasource, then results are never being fetched (because PreRender stage is not being executed), causing the exception I have posted. Normal ASP.NET functionality does not walk controls that have Visible set to false. This can be clearly seen from the example I have posted previously - the page crashes with Menu control in it (i.e. it tries to do data binding even when GridView control is not visible); without Menu control everything is being rendered without crashes, because data binding is not even attempted on an invisible GridView control.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
I see. That makes sense. We will look into the code and see if we can skip invisible ones.
Thanks!
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
We have posted a new build that should fix this problem. Please see your private message for the download location.
Thanks!
|
Rank: Advanced Member Groups: Member
Joined: 3/23/2010 Posts: 35
|
Thanks, the crashes disappeared with this new build.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Glad to hear that it works! Please let us know if you see any other issues.
Thanks!
|