Access Violation when closing an Aurelius Dataset

Delphi is 10.4 NOV, 2022

Hello TMS,

When I close an Aurelius dataset closes I sometimes (frequently but not always) get an access violation.

procedure Example(...; ADst: TAureliusDataset);
begin
  with ADst do
  begin
    Close;
    Manager := cached Manager : TObjectManager;
    SetSourceCriteria(Criteria);
    Open;
  end;
end;

Below is part of the Except Report. Any ideas? thanks

message is "Access violation at address 0040A538 in module 'bmrelay.exe'. Read of address FFFFFFED": 
System.TObject.InheritsFrom (Line 18726, "System.pas" + 6) + $0 
System.@HandleAnyException$qqrv (Line 20966, "System.pas" + 13) + $0 
Aurelius.Bind.BaseDataset.TBaseAureliusDataset.InternalClose (Line 1266, "Aurelius.Bind.BaseDataset.pas" + 13) + $5 Data.DB.TDataSet.CloseCursor (Line 12705, "Data.DB.pas" + 6) + $4 
Data.DB.TDataSet.Close (Line 12608, "Data.DB.pas" + 0) + $4
 message is "Access violation at address 0040A538 in module 'bmrelay.exe'. Read of address FFFFFFF0":
System.TObject.InheritsFrom (Line 18726, "System.pas" + 6) + $0
System.@HandleAnyException$qqrv (Line 20966, "System.pas" + 13) + $0
Aurelius.Bind.BaseDataset.TBaseAureliusDataset.SetSource (Line 2114, "Aurelius.Bind.BaseDataset.pas" + 3) + $5
Aurelius.Bind.Dataset.TCustomAureliusDataset.SetSourceCriteria (Line 517, "Aurelius.Bind.Dataset.pas" + 1) + $18
Aurelius.Bind.Dataset.TCustomAureliusDataset.SetSourceCriteria (Line 511, "Aurelius.Bind.Dataset.pas" + 1) + $8
procedure TCustomAureliusDataset.ClearInternalList;
begin
  // if the list contain TCriteriaResult objects, then
  // destroy those objects since they are not being managed anywhere

  // Extra check for FInternalList
  if not Assigned(FInternalList) then
    Exit;

  if (FInternalList.Count > 0) and (FInternalList[0] is TCriteriaResult) then //FInternalList[0] is nill
    FInternalList.OwnsObjects := true;
  try
    FInternalList.Clear;
  finally
    FInternalList.OwnsObjects := false;
  end;
end;

The code that caused the exception
FInternalList[0] is nil

Which version of TMS Aurelius are you using? Looks like an old one. I'd recommend you first upgrade to the latest version and see if the problem still occurs.