EMappingNotFound on TEntityLoader

Hi!

I have a strange issue using Aurelius. I have a search window that executes this code on search. The searcher is used as a step in a process of filling and saving an object.

The searcher works OK for the first time. I can also open the window several times during the process and it opens and searches OK. But if I flush the object at the end of the process, then on redoing the same process, the searcher gives me this error:

---------------------------
Debugger Exception Notification
---------------------------
Project Client.win.exe raised exception class EMappingNotFound with message 'Cannot find mapping [Id] on class TEntityLoader.'.
---------------------------
Break   Continue   Help   
---------------------------

Stack Trace:
exception class    : EMappingNotFound
exception message  : Cannot find mapping [Id] on class TEntityLoader.

main thread ($18b8):
008c707d +035 Client.win.exe Aurelius.Mapping.Explorer      1539   +3 TMappingExplorer.GetId
008c70b5 +015 Client.win.exe Aurelius.Mapping.Explorer      1546   +1 TMappingExplorer.GetIdColumns
008c71d7 +03f Client.win.exe Aurelius.Mapping.Explorer      1576   +1 TMappingExplorer.GetIdValue
00827e33 +01b Client.win.exe Aurelius.Engine.ObjectMap       276   +1 TObjectMap.GetIdValue
00827b82 +036 Client.win.exe Aurelius.Engine.ObjectMap       219   +1 TObjectMap.GenerateKey
0082818c +028 Client.win.exe Aurelius.Engine.ObjectMap       360   +1 TObjectMap.IsIdMapped
008782bb +0db Client.win.exe Aurelius.Engine.ObjectManager   412  +19 TObjectManager.GetUniqueInstances
00877ef5 +055 Client.win.exe Aurelius.Engine.ObjectManager   335   +7 TObjectManager.GetUniqueInstance
0087c271 +0b5 Client.win.exe Aurelius.Engine.ObjectManager  2083  +18 TObjectManager.TEngineCursor.Next
00878b2a +046 Client.win.exe Aurelius.Engine.ObjectManager   646   +3 TObjectManager.List
00805347 +01f Client.win.exe Aurelius.Criteria.Base         1013   +1 TCriteria.FillList
00f687e5 +041 Client.win.exe dmMain                         1111   +4 TCriteria.List<SaketinEntities.TStranka>
00f67c8c +00c Client.win.exe dmMain                         1318   +1 {Aurelius.Criteria.Base}TCriteria<SaketinEntities.TStranka>.List
00f75982 +0e2 Client.win.exe Iskalnik                        114   +4 TfrmIskalnik.Isci
00f75a6e +046 Client.win.exe Iskalnik                        123   +2 TfrmIskalnik.tmrGoTimer
00656bbb +00f Client.win.exe Vcl.ExtCtrls                   3120   +1 TTimer.Timer
00656a9f +02b Client.win.exe Vcl.ExtCtrls                   3078   +4 TTimer.WndProc
00544514 +014 Client.win.exe System.Classes                17405   +8 StdWndProc
763961ab +00b USER32.dll                                              DispatchMessageW
006d3ad3 +0f3 Client.win.exe Vcl.Forms                     10641  +23 TApplication.ProcessMessage
006d3b16 +00a Client.win.exe Vcl.Forms                     10671   +1 TApplication.HandleMessage
006ceed2 +1aa Client.win.exe Vcl.Forms                      7393  +33 TCustomForm.ShowModal
00f79f63 +03f Client.win.exe Izdaja                          250   +2 TfrmIzdaja.btnIzberiStrankoClick
005c611f +073 Client.win.exe Vcl.Controls                   7454   +9 TControl.Click
005e9a3e +01e Client.win.exe Vcl.StdCtrls                   5449   +3 TCustomButton.Click
005ea54c +010 Client.win.exe Vcl.StdCtrls                   5910   +1 TCustomButton.CNCommand
005c5bb2 +2be Client.win.exe Vcl.Controls                   7338  +91 TControl.WndProc
005ca797 +63b Client.win.exe Vcl.Controls                  10209 +166 TWinControl.WndProc
005e96e8 +06c Client.win.exe Vcl.StdCtrls                   5286  +13 TButtonControl.WndProc
005c57ec +024 Client.win.exe Vcl.Controls                   7116  +10 TControl.Perform
005ca8fb +023 Client.win.exe Vcl.Controls                  10278  +12 DoControlMsg
005cb387 +00b Client.win.exe Vcl.Controls                  10553   +1 TWinControl.WMCommand
005c5bb2 +2be Client.win.exe Vcl.Controls                   7338  +91 TControl.WndProc
005ca797 +63b Client.win.exe Vcl.Controls                  10209 +166 TWinControl.WndProc
005c9d64 +02c Client.win.exe Vcl.Controls                   9908   +3 TWinControl.MainWndProc
00544514 +014 Client.win.exe System.Classes                17405   +8 StdWndProc
7639670e +11e USER32.dll                                              SendMessageW
763967ea +07a USER32.dll                                              CallWindowProcW
005ca8a6 +0e6 Client.win.exe Vcl.Controls                  10250  +30 TWinControl.DefaultHandler
005c6574 +010 Client.win.exe Vcl.Controls                   7587   +1 TControl.WMLButtonUp
005c620c +08c Client.win.exe Vcl.Controls                   7477   +7 TControl.DoMouseDown
005c5bb2 +2be Client.win.exe Vcl.Controls                   7338  +91 TControl.WndProc
005ca797 +63b Client.win.exe Vcl.Controls                  10209 +166 TWinControl.WndProc
005e96e8 +06c Client.win.exe Vcl.StdCtrls                   5286  +13 TButtonControl.WndProc
005c9d64 +02c Client.win.exe Vcl.Controls                   9908   +3 TWinControl.MainWndProc
00544514 +014 Client.win.exe System.Classes                17405   +8 StdWndProc
763961ab +00b USER32.dll                                              DispatchMessageW
006d3ad3 +0f3 Client.win.exe Vcl.Forms                     10641  +23 TApplication.ProcessMessage
006d3b16 +00a Client.win.exe Vcl.Forms                     10671   +1 TApplication.HandleMessage
006d3e49 +0c9 Client.win.exe Vcl.Forms                     10809  +26 TApplication.Run
00fab921 +061 Client.win.exe Client.win                       36   +5 initialization
76150417 +017 KERNEL32.DLL                                            BaseThreadInitThunk

This is the code that executes the search

procedure TfrmIskalnik.Isci(Filter: string);
var
  criteria: TCriteria<TStranka>;
begin
  adsClients.Close;
  criteria := Manager.Find<TStranka>;
  criteria.Where(Linq['Naziv'].Like('%'+Filter+'%') or Linq['Naslov'].Like('%'+Filter+'%'));
  FResultList := criteria.List;
  adsClients.SetSourceList(FResultList);
  adsClients.Open;
end;

Fist there was just 
  adsClients.SetSourceCriteria(criteria);

buti I changed it during test. SetSourceCriteria gives me the same error.

Since it is a small program, I can send you the full code if you wish (I just remove some small parts).

It simply looks like accessing a destroyed object. Haven't you destroyed (in other parts of the code) some TStranka objects that are in the manager?

You can send the project if you want, we will take a look. Just please don't use 3rd party components and make sure it would run and work here on our side. If the code is small you can paste it here too.