RO Server crashes upon a service method return?

  • Delphi XE5,
  • RO SDK version 9.4.109.1377 (the latest official release).

I have the following very simple test case to replicate the crash:
RoTest.zip (117.4 KB)

The RO Server crashes at the method call GetRemoteServiceStatus.

Debugging track shows that the crash happened at the following:

Any advice why this happens?

const 
  __ServiceName ='NewService';

type
  TRemoteServerStatus = (arsNull, arsStarting, arsRunning, arsStopping,
    arsReadyToStart);

  TRemoteServiceReply = class(TROComplexType)
  private
       FCode: Integer;
       FConnectionID: string;
       FDetail: string;
  published
    property Code: Integer read FCode write FCode;
    property ConnectionID: string read FConnectionID write FConnectionID;
    property Detail: string read FDetail write FDetail;
  end;
  
  [ROService(__ServiceName)]
  TNewService = class(TRORemoteDataModule)
  public
    [ROServiceMethod]
    function GetRemoteServerStatus(aConnectionID: string; out aStatus:
        TRemoteServerStatus): TRemoteServiceReply;
  end;

implementation

function TNewService.GetRemoteServerStatus(aConnectionID: string; out aStatus:
    TRemoteServerStatus): TRemoteServiceReply;
begin
  Result := TRemoteServiceReply.Create;

  Result.Code := 0;
  Result.ConnectionID := aConnectionID;
  Result.Detail := 'N/A';
end;

{%CLASSGROUP 'System.Classes.TPersistent'}
{$R *.dfm}

initialization
  RegisterCodeFirstService(TNewService);
end.

Hi,

I can’t reproduce this issue:

Can you retest this issue with latest beta, pls?

Thank you I will check the latest beta

One thing I like to mention: the crash seems happen with XE5 only. Tokyo 10.2.3 runs ok. I don’t know why. I will check with the latest beta

hmm, I’ve tested with Tokyo 10.2.3. will recheck with XE5

Thanks, logged as bugs://81240

EMBT have introduced TArray.Copy<T> in XE7, but their compiler didn’t raise any exception in XE5 that this method isn’t found :frowning:

workaround: update TRORttiClientCache.GetProperties_OriginalSort method (uRORTTISupport.pas) as
old:

if Length(result) > 0 then
  TArray.Copy<TRttiProperty>(result, lResult, Length(result));

new:

  if Length(result) > 0 then begin
    {$IFDEF DELPHIXE8UP}
    TArray.Copy<TRttiProperty>(result, lResult, Length(result));
    {$ELSE}
    System.Move(Pointer(@result[0])^, Pointer(@lResult[0])^, Length(result) * SizeOf(TRttiProperty));
    {$ENDIF}
  end;

bugs://81240 got closed with status fixed.

Thank you. Will this fix be included in a nightly build (or some quick beta release) that I can use immediately? I don’t want to touch the source code myself. :slight_smile:

yes, this fix will be in weekly beta.
but you can apply it manually to sources if you want to test it immediately: