You are not logged in.
Hi,
I believe I finally have made it down to the problem, that is arising.
Now there are basically two possibilities for my problem:
a) (likely) - me using TRttiCustom incorrectly
b) something in the handling of empty UTF8String-properties
The full sample is at: https://pastebin.com/ENbYBjm4
When ran as show, it will throw an exception when using SetValue.
To NOT see the exception, set Source.Field_01 to anything, BUT an empty string.
Fun fact: i have about 50 regression tests against my Domain-ORM-mapper with various data, incl. empty strings, all of them succeeded. However, this simple sample crashed.
Added it to my tests now as well and hoping to learn more about my problem.
Regards
Daniel
P.S: Tested on Delphi 10.4.2 and Delphi 11.0 - Win32
Last edited by sakura (2021-10-11 10:50:30)
Offline
You are indeed using low-level RTTI code, which may be confusing to use.
It was designed for the particular use of mORMot RTTI internals.
Those GetValue/SetValue are used only in some border-case by our unit, when a getter or a setter are needed. So they are not fully tested, in all possible cases. See for instance how TRttiCustomProps.CopyProperties is implemented.
So it appears that you found a bug.
It should be fixed now with my latest commit. The void string is now passed as varByRef, as it should.
I am very sorry for the inconvenience.
Offline
It looks great - and thank YOU, bugs come with software, it is just strange how this came up, rather with that update, actually not related to it...
I'll take a close look at CopyProperties tomorrow :-)
Thanks again,
Daniel
Offline