You are not logged in.
mormot.core.collections, line 902
if fDynArray.Info.ArrayRtti is nil then fDynArray.Info.ArrayRtti.Kind will cause exception
I have random errors from that
constructor TIListParent.CreateRtti(aDynArray: TRttiCustom;
aItemTypeInfo: PRttiInfo; aOptions: TListOptions; aSortAs: TRttiParserType);
begin
fDynArray.InitRtti(aDynArray, fValue, @fCount);
aSortAs := fDynArray.SetParserType(aSortAs, // aSortAs=ptNone->RTTI
loCaseInsensitive in fOptions);
if (fDynArray.Info.ArrayRtti = nil) or
(fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind) then
EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
[self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);
Offline
@ab, Delphi 11.3 in a Torm class
but:
if (fDynArray.Info.ArrayRtti = nil) or
(fDynArray.Info.ArrayRtti.Kind <> aItemTypeInfo^.Kind) then
EIList.RaiseUtf8('%.Create<%> (%) does not match % (%)',
[self, aItemTypeInfo^.RawName, ToText(aItemTypeInfo^.Kind)^,
aDynArray.Info^.RawName, ToText(fDynArray.Info.ArrayRtti.Kind)^]);
Offline
Apologies Ab, I did not define anything new
I noticed that this happens since the updates in github after 3/11/25
The exception I get is in EIList.RaiseUtf8 and when debugging the fDynArray.Info.ArrayRtti is nil
Offline
I still don't understand how you defined the IList instance.
I was using NewPlainList instead of NewList, as I notice now.
But still, in the above code if fDynArray.Info.ArrayRtti = nil, then the fDynArray.Info.ArrayRtti.Kind in EIList.RaiseUtf8 will give exception
Offline
I have got it! ![]()
There is a bug in this statement: if the ArrayRtti property is nil (by any reason) then the condition in the "if" statement is fine due to the short-circuit evaluation. But then the EIList.RaiseUtf8() is called and the ArrayRtti.Kind is used as a parameter value!
Offline
I still don't understand how you defined the IList instance.
TormGetbundle=class(Torm)
private
Fdedo: RawUtf8; Fupddat: tdatetime; Ftyp,Fekdosi: integer;
public
class procedure InitializeTable(const Server: IRestOrmServer; const FieldName: RawUtf8; Options: TOrmInitializeTableOptions); override;
published
property typ:integer read Ftyp write Ftyp;
property ekdosi:integer read Fekdosi write Fekdosi;
property dedo:RawUtf8 read Fdedo write Fdedo;
property upddat:tdatetime read Fupddat write Fupddat;
end;
The errors happens when I do the following:
lis:=collections.NewList<TormGetbundle>;
TormGetbundle in this windows app is not an db table, (part of shared code with an other app that uses it as db table)
Offline