LoadChartFromStream causes an exception when SaveChartToStream has saved some of my custom properties.
It crashes with "property MyCoolProperty does not exist".
type
TMyChart = class(TChart)
strict private
MyCoolProperty: Integer;
published
property MyCoolProperty: Integer read FMyCoolProperty write FMyCoolProperty;
end;
Chart, CopyChart: TMyChart;
MStream := TMemoryStream.Create;
try
SaveChartToStream(Chart, MStream, False, False);
MStream.Position := 0;
LoadChartFromStream(TCustomChart(CopyChart), MStream);
finally
MStream.Free;
end;
How to make LoadChartFromStream ignore properties that it cannot cope with and load properties that it can load without breaking the whole because of one small part?
Let me copy the reply from here, where a similar issue was addressed