This question already has an answer here:
How to access the private method TStreamReader.FillBuffer in Delphi 10.1 Berlin, we did it with a class helper before 10.1 - but the proposed solution does not work:
uses System.Rtti;
procedure TForm1.FormCreate(Sender: TObject);
begin
Assert(Assigned(TRttiContext.Create.GetType(TStreamReader).GetMethod('FillBuffer')),
'Failed');
end;
it fails just because GetMethod returns NIL. Any ideas why this fails?
Edited: I do want to know WHY it fails
It fails because the private methods aren't included in this class. See RTTI access to private methods of VCL, e.g. TCustomForm.SetWindowState
There is a workaround for getting the private method though:
See: How to access private methods without helpers?