#1 2019-08-07 14:30:51

ertank
Member
Registered: 2016-03-16
Posts: 163

Access violation at json de-serialization

Hello,

This problem is not on my computer but at someone else's who is using mORMot because I suggested.

Delphi 10.3.1, SynopseCommit 1.18.5243, targeting Win32 executable.

Error message says:

First chance exception at $7536FD62. Exception class EAccessViolation with message 'Access violation at address 0040CBC4 in module 'Teklif.exe'. Read of address F9CC0011'. Process Teklif.exe (1220)

Json de-serialization code where exception raises is:

  try
    if not SynCommons.RecordLoadJSON(Response, RawUTF8(Response), TypeInfo(TGetDueDateResponse)) then Exit(False);  // <--- HERE
  except
    Exit(False);
  end;

Response value at the time of exception:

{  
   "license":1,
   "message":true,
   "duedate":"2019-06-12T05:38:48.000000Z",
   "systemdate":"2019-08-07T14:13:23.787244Z",
   "result":true,
   "error":""
}

TGetDueDateResponse definition:

  TGetDueDateResponse = packed record
    license: Integer;
    &message: Boolean;
    duedate: TDateTime;
    systemdate: TDateTime;
    result: Boolean;
    error: string;
  end;

Lastly, here is the call stack in Delphi when exception occurs: https://i.imgyukle.com/2019/08/07/oP2Rqp.png

I simply could not understand what problem may be.

Any help is appreciated.

Thanks & regards,
Ertan

Offline

#2 2019-08-07 14:49:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: Access violation at json de-serialization

I guess the problem is in your code.

RecordLoadJSON(Response, RawUTF8(Response), .... sounds clearly wrong.

Offline

#3 2019-08-07 15:38:16

ertank
Member
Registered: 2016-03-16
Posts: 163

Re: Access violation at json de-serialization

My bad. You are correct. It was working fine and that person seems to have changed the code and I simply did not see that.

Thanks for the reply.

Offline

Board footer

Powered by FluxBB