StrataFrame Forum

Collection was modified; enumeration operation may not execute.

http://forum.strataframe.net/Topic30037.aspx

By ChanKK - 5/30/2011

Hi
I hit error as subject, and Idea? As we can see from the stack trace, it happen within ParseChildControl recursive call randomly. Please advice. Urgent.

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.ControlCollection+ControlCollectionEnumerator.MoveNext

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

MicroFour.StrataFrame.UI.Web.BasePage.ParseChildControl

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

MicroFour.StrataFrame.UI.Web.BasePage.ParseChildControl

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

MicroFour.StrataFrame.UI.Web.BasePage.ParseChildControl

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

MicroFour.StrataFrame.UI.Web.BasePage.ParseChildControl

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

MicroFour.StrataFrame.UI.Web.BasePage.GetListOfControls

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

MicroFour.StrataFrame.UI.Web.BasePage.Page_PreLoad

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.OnPreLoad

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

Vfs.Generic.UI.Web.Strataframe.Forms.DataEntryBasePage.OnPreLoad

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.ProcessRequestMain

 

Handled At

 

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.HandleError

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.ProcessRequestMain

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.ProcessRequest

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.ProcessRequest

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.UI.Page.ProcessRequestWithNoAssert

http://172.22.24.52:8080/console/modules/system:netrequest/images/parameterExist.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

ASP page : /FlexEA/PayStatement/Forms/PaySlipReport.aspx

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

ASP.paystatement_forms_payslipreport_aspx.ProcessRequest

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.HttpApplication.ExecuteStep

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.HttpApplication+ApplicationStepManager.ResumeSteps

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.HttpApplication.ResumeSteps

http://172.22.24.52:8080/console/modules/system:netrequest/images/parameterExist.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

Request : /FlexEA/PayStatement/Forms/PaySlipReport.aspx

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.HttpRuntime.ProcessRequestInternal

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.HttpRuntime.ProcessRequestNoDemand

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

http://172.22.24.52:8080/console/modules/system:netrequest/images/emptySign.gif

System.Web.Hosting.ISAPIRuntime.ProcessRequest

By ChanKK - 5/30/2011

My code in case

DataEntryBasePage.cs

protected override void OnPreLoad(EventArgs e)
        {
            //-- Vault Comments:
            //-- SF use property name (BusinessLater derived type) as key
            //-- when store BO instance to session. It meant difference page
            //-- might use the same BO instance if they are defined with 
            //-- same property name in page. It has possiblity that BO data/state 
            //-- defined in page not compatible with others. Since we unable to 
            //-- override this behavour (private methods), workaround is to
            //-- dispose BO instance at session before SF initialize BO.

            //-------------------------------------------------
            //-- Dispose BO instance in session which used in 
            //-- this page to avoid "conflict" with other page
            //-------------------------------------------------

            if (!this.Page.IsPostBack && !this.Page.IsCallback)
            {
                //this.RemoveUnusedBusinessObjectsFromSession();
                this.RemoveBusinessObjectsInstanceFromSession();
            }

            base.OnPreLoad(e);
        }

private void RemoveBusinessObjectsInstanceFromSession()
        {
            string businessObjectName = string.Empty;
            BusinessLayer businessObject;

            PropertyInfo[] propertyInfos = GetBusinessObjectInfosEx();
            foreach (PropertyInfo propInfo in propertyInfos)
            {
                businessObjectName = propInfo.Name;

                businessObject = SessionManager.Instance.Get<BusinessLayer>(businessObjectName);

                if (businessObject != null)
                {
                    businessObject.Dispose();
                    businessObject = null;

                    SessionManager.Instance.Set(businessObjectName, null);
                }
            }
        }