Version 63 raises an EInsufficientRtti

I made a try of the 6.3 Versions. Now the init of a lot Librarys I generated automatically by the "Pas file import tool for Scripter" raises an error of the class EInsufficientRtti

Unzureichende RTTI zur Unterstützung dieser Operation

I debuged the Init of the Library of my TwwDBGrid (infopower). The exception raises by the Scripter.DefineClassByRTTI(TwwBookmarkList); This one is a own class holding a array of TBookmark. So it seems the new 6.3 function of automatic registration via RTTI of indexed properties fails.

my questions:
- is there a quick simple method to solve?
- if no quick solution, how to dissable the new index property autoregistration function?

...hmm... maybe, just as an idea for next version, a try except around the eg TRttiMethod.MethodKind/GetType.. and others which simply do not registering the indexed property instead of raising and aborting the code?

At the moment I gone back to the 6.2 version which works for me.





Which Delphi version do you use? Can you point out the exact point in TMS Scripter source code that it fails, maybe with a call stack? Does the problem only occur in the TwwDBGrid? All other imports with indexed properties you have work fine? Is TwwDBGrid compiled with no RTTI info?

  • I am on Delphi XE2
    - I isolated the raise to the TwwDBGrid and there to the Subclass TwwBookmarkList (all other seems to work fine)
    - I searched about the compiler switch $RTTI EXPLICIT METHODS but nothing found (all other .DefineClassByRTTI of the wwdbgrid sublasses work so I do not think that there is a explicit disable)
    - the raise occures in the unit atScript at procedure AddClassByRTTIEx which is called by the Scripter.DefineClassByRTTI(TwwBookmarkList).

        // define indexed properties
        {$IFDEF DELPHIXE2_LVL}
        iprops := rtype.GetDeclaredIndexedProperties;
        for iprop in iprops do
        begin
          if iprop.Visibility in AVisibilityFilter then
          begin
            if iprop.IsReadable then
              Getter := FScripter.GenericIdxPropGetterMachineProc
            else
              Getter := nil;
            if iprop.IsWritable then
              Setter := FScripter.GenericIdxPropSetterMachineProc
            else
              Setter := nil;
            regClass := FScripter.ScrClassType(iprop.PropertyType);

Breakpoint at the last line of that snipped I allready see the EInsufficientRtti by moving the mouse over the the iprop.PropertyType. By executing the line via F8 the raise occoures.

First I thought the raise also affect other places and component librarys. But now I see that just the TwwDBGrid Subclass TwwBookmarkList is affected. Removing the single line Scripter.DefineClassByRTTI(TwwBookmarkList) from my TwwDBGrid Scripter Library simply solves the error. I made some tests and it seems I do not need need for the basic events or props for a working TwwDBGrid in Scripter. I'll comment out and do some more tests.
If you want more info I have some screenshots here from the IDE which shows some values at the moment of raising. just tell me where I can send the screenhots.


I guess this might be a Delphi limitation due to the type of that property. How exactly is that property declared in TwwBookmarkList? My guess is that it's a type which Delphi doesn't provide RTTi for some reason. Is it TBytes or TArray<byte>?

it is a TBookmark (from Data.DB) which is, as I seen, an alias for TBytes
Data.DB

{ TDataSet }

  TBookmark = TBytes;

 

TwwBookmarkList = class
  private
    FList: array of TBookmark;
    .....
    function GetItem(Index: integer): TBookmark;
    procedure InsertItem(Index: integer; Item: TBookmark);
    procedure DeleteItem(Index: integer);
    ....
  protected
    function CurrentRow: TBookmark;
  public
    ....
    property Items[Index: integer]: TBookmark read GetItem; default;
    ....
  end;


I guess there will come more posts from other users from failing registry cause of unsupported RTTi types in their 3rd Party component libraries. So is there a handler (or maybe a proberty) included into the atScript which do not raise in such cases and simply ignore the indexed property?

You can change the "if" line with this code:


            if (prop.Visibility in AVisibilityFilter) and (prop.PropertyType <> nil) then

and the property will be ignored. We will add this change to our development version here so next version will include it. Unfortunately this is a limitation in Delphi, some types do not have RTTI information available.