Search code examples
delphidatasnapfiredac

Delphi Tokyo 10.2 - 710 invalid binary storage format


I am working on firemonkey using REST/Jason, however, when I connect to my methods server through DataSnap Client Classes to get the return of my query, the following line throws an exception:

Result := TFDJSONDataSets(FUnMarshal.UnMarshal(FGetAlunoAutenticacaoCommand.Parameters[3].Value.GetJSONValue(True)));

enter image description here

Important:

It went without saying that the problem only occurs in the iOS simulator.

When I use ANDROID or WIN32 the problem does not happen.

enter image description here

Anyone have any suggestions?


Solution

  • I've got the same error on iOS. After some investigation, I found the bug causing this error in Embarcadero's source code.

    Unit Data.FireDACJSONReflect has function MemTableFromString(...). Inside this function the line (435) LMemoryStream.Seek(Longint(0), soFromBeginning); meant to set LMemoryStream.Position to 0. It does so on all platforms except for iOS (I've tested on Win32/64 and Android). On iOS it does nothing. (the actual parameters of Seek function call becomes 0 and soCurrent).

    Just changed this line (435) in unit Data.FireDACJSONReflect

    LMemoryStream.Seek(Longint(0), soFromBeginning);
    

    to the proper one

    LMemoryStream.Seek(0, TSeekOrigin.soBeginning);
    

    (You need to save corrected unit somewhere, add it to your project and replace old unit with the new one in uses clause of your source)