Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/VCL/Type Info    [ Add a report in this area ]  
Report #:  85308   Status: Withdrawn
Enumerating methods for TRttiInterfaceType fails.
Project:  Delphi Build #:  14.0.3513.24210
Version:    14.0 Submitted By:   Joar Bølstad
Report Type:  Basic functionality failure Date Reported:  6/10/2010 12:59:49 AM
Severity:    Commonly encountered problem Last Updated: 6/10/2010 1:28:45 AM
Platform:    All platforms Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
None
Steps to Reproduce:
The following code does not return the expected result:

program rtti_sb_1;
{$APPTYPE CONSOLE}
uses
  SysUtils, Rtti, mynamespace in 'mynamespace.pas';
var
  ctx:      TRttiContext;
  RType:    TRttiType;
  Method:   TRttiMethod;
begin
  ctx := TRttiContext.Create;
  RType := ctx.GetType(TypeInfo(IMyPrettyLittleInterface));
  if RType <> nil then begin
    for Method in RType.GetMethods do
      WriteLn(Method.Name);
  end;
  ReadLn;
end.

where mynamespace.pas contains

IMyPrettyLittleInterface = interface
  ['{6F89487E-5BB7-42FC-A760-38DA2329E0C5}']
  procedure SomeProcedure;
end;

The length of the returned TArray<TMethod> is zero; expected length is one. Mason Wheeler tracked the problem to TRttiInterfaceType.Create at line 5774 at which he concluded that no RTTI is generated for interface methods. See http://stackoverflow.com/questions/3004045/delphi-trttitype-getmethods-return-zero-trttimethod-instances/3005836#3005836 for details.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01