#1 2026-06-09 09:52:31

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 531

'Invalid variant type'. finalizatron error

After commit e6bf459b17a676bd052d09ccab21ea76413cb876 I am getting record finalization error with the following stack:
Project pc.exe raised exception class EVariantBadVarTypeError with message 'Invalid variant type'.
https://gist.github.com/dkounal/99361a1 … bb4296bfa2

Offline

#2 2026-06-09 19:30:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,502
Website

Re: 'Invalid variant type'. finalizatron error

Is it still the case?

It sounds like if the variant is identified as a varArray, which should not be possible with pure mORMot code.
We would need some minimum reproducible example, please.

Offline

#3 Today 08:49:01

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 531

Re: 'Invalid variant type'. finalizatron error

please change in mormot.core.rtti.pas line 6877 to the following:

    if (ElemInfo <> nil) and
       (p^.length > 0) then 
          FastFinalizeArray(Value^, ElemInfo, p^.length);

It seems to work ok with the above

Offline

#4 Today 13:17:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,502
Website

Re: 'Invalid variant type'. finalizatron error

It is really unexpected to have p^.Length = 0 here.
A void dynamic array is expected to be stored as a nil pointer, not something with Length=0 in its headers.
I suspect there is something wrong elsewhere.

At least I have hardened FastFinalizeArray() usage:
https://github.com/synopse/mORMot2/commit/aad4c731a

Offline

Board footer

Powered by FluxBB