We're seeing an issue with Delphi XE where, at times, TRttiType.GetTypes returns an empty array. Other times, using the exact same code, the array contains the expected types. The error is occurring when marshalling/unmarshalling classes over DataSnap using TJSONMarshal and TJSONUnMarshal.
Any idea why the call to GetTypes in the unit below would return an empty array?  (The $M directive should not be required.  It is there as I've tried several brute-force approaches, including $STRONGLINKTYPES.)
unit uTest;
interface
uses
  Classes;
type
{$M+}
  TMyClass = class(TPersistent)
  public
    Value1 : Integer;
    Value2 : String;
    Value3 : Currency;
    Value4 : Boolean;
    Value5 : Double;
end;
procedure Test;
implementation
uses
  Dialogs, Rtti, SysUtils;
procedure Test;
var
  c: TRttiContext;
  t: TRttiType;
  a: TArray<TRttiField>;
begin
  c := TRttiContext.Create;
  t := c.GetType(TypeInfo(TMyClass));
  if Assigned(t) then begin
    a := t.GetFields;
    ShowMessage(IntToStr(High(a)));
  end
  else
    ShowMessage('TMyClass not found');
end;
procedure ForceReferenceToClass(C: TClass);
var
  dummy: TObject;
begin
  dummy := C.Create();
  dummy.Free();
end;
initialization
  ForceReferenceToClass(TMyClass);
end.
Thanks
 
    