I have a user control on one of my page and I am getting below error on this page
Object reference not set to an instance of an object.
I have resolved this issue very easily but I found something strange in the stack trace of this error.
When I checked stack trace this was like below
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
It is not the complete stacktrace but a part of it. I want to know what is the role of this function "System.Web.UI.Control.LoadRecursive()". It is called 11 time and I am afraid that this may cause performance issue in my application. I think this function is called because I am using user control. I am using this kind of user controls at many places in my application.
Please tell me if any one knows about this.
LoadRecursive()
makes a call to the current control's OnLoad()
method and then will recursively call LoadRecursive()
on all of its child controls, including those nested in the html.
So you will have 1 LoadRecursive()
call on the stack for every parent control that has been passed through to get to your custom control. Composite controls can have many in one which will add to the depth.
It is not necessarily a performance problem. Just an indication of nesting depth.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With