Are you able to consistently reproduce this issue? If yes, I can try to send you a modified version of TDynamicProperties to see if it can solve your problem.
it would work if TDynamicProperties.Destroy would look like this:
destructor TDynamicProperties.Destroy;
var
Prop: TValue;
begin
// Destroy dynamic properties that are lists.
for Prop in FProps.Values do
if Prop.IsObject and not Prop.IsEmpty and Bcl.Collections.IsObjectList(Prop.TypeData.ClassType) then
Prop.AsObject.Free;
FProps.Free;
inherited;
end;
I could reproduce this issue most times, but not in every try...
What do you think about this fix?