DevExpress XAF XPO GetObjectsNonReenterant Exception

Date: 2024-11-20
Entering state 'GetObjectsNonReenterant' from state 'GetObjectsNonReenterant' is prohibited due to state 'GetObjectsNonReenterant' for 'Iperen.PDB.Base.CustomObjectSpace.PDBUnitOfWork(26)'. Most probably, you are trying to initiate an object loading operation while the previous object loading operation is not yet completed. Postpone your operation until the Session.ObjectsLoaded or IXPObject.OnLoaded event is fired (while Session.IsObjectsLoading is true). Another cause of this exception is that you are trying to work simultaneously with the same session from different threads.

   at DevExpress.Xpo.Helpers.SessionStateStack.ThrowIfCantEnter(Session session, SessionState newState)
   at DevExpress.Xpo.Helpers.SessionStateStack.Enter(Session session, SessionState newState)
   at DevExpress.Xpo.Helpers.ObjectCollectionLoader.LoadObjects(ObjectsQuery[] queries)
   at DevExpress.Xpo.SimpleObjectLayer.LoadObjects(Session session, ObjectsQuery[] queries)
   at DevExpress.Xpo.Logger.LogManager.Log[T](String category, LogHandler`1 handler, MessageHandler`1 createMessageHandler)
   at DevExpress.Xpo.Session.GetObjects(ObjectsQuery query)
   at DevExpress.Xpo.XPBaseCollection.Load()
   at DevExpress.Xpo.XPBaseCollection.get_Objects()
   at DevExpress.Xpo.XPBaseCollection.get_Count()
   at DevExpress.Data.Helpers.BaseDataControllerHelper.get_Count()
   at DevExpress.Data.DataController.get_VisibleListSourceRowCount()
   at DevExpress.XtraGrid.Helpers.Indexes.GridVisibleIndexCollection.get_Count()
   at DevExpress.XtraGrid.Views.Grid.GridView.get_RowCount()
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridPixelPositionCalculatorBase.Check()
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcCore(Graphics g, Rectangle bounds)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.Calc(Graphics g, Rectangle bounds)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.FullRecalcScroll(Graphics g, Rectangle bounds)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcAfterVertScrollCore(Graphics g, Rectangle bounds, Boolean useCache, Boolean ignoreListChangedEvent)
   at DevExpress.XtraGrid.Views.Grid.ViewInfo.GridViewInfo.CalcAfterVertScroll(Graphics g, Rectangle bounds, Boolean useCache, Boolean ignoreListChangedEvent)
   at DevExpress.XtraGrid.Views.Grid.GridView.RefreshRowsCore(Boolean useCache, Boolean afterScroll)
   at DevExpress.XtraGrid.Views.Grid.GridView.RefreshRows(Boolean useCache, Boolean afterScroll)
   at DevExpress.XtraGrid.Views.Grid.GridView.CalculateDataCore()
   at DevExpress.XtraGrid.Views.Grid.GridView.CalculateData()
   at DevExpress.XtraGrid.Views.Base.BaseView.Draw(GraphicsCache e)
   at DevExpress.XtraGrid.Views.Grid.GridView.Draw(GraphicsCache e)
   at DevExpress.XtraGrid.GridControl.OnPaintCore(PaintEventArgs e)
   at DevExpress.Utils.Drawing.ControlPaintHelper.PaintWithErrorHandling(PaintEventArgs paintEventArgs, Int32 layer)
   at DevExpress.Utils.Drawing.ControlPaintHelper.ProcessWMPaintCore(Boolean beginPaint, IntPtr hdc, Rectangle rectangle, Rectangle[] clipBounds)
   at DevExpress.Utils.Drawing.ControlPaintHelper.ProcessWMPaint(Message& m)
   at DevExpress.XtraGrid.GridControl.CheckProcessMsg(Message& m)
   at DevExpress.XtraGrid.GridControl.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Solution

// Add the attribute above the property/class of searching
[LookupEditorMode(LookupEditorMode.AllItemsWithSearch)]

// And fix possible PersistentAlias attributes 
[PersistentAlias()]
90710cookie-checkDevExpress XAF XPO GetObjectsNonReenterant Exception