错误的 RTTI 可见性信息和缺失的属性
我的应用程序中本质上有以下类
TCategory = class(TAbstractionTreeItem)
private
fName: String;
fParent: Integer;
fComment: String;
public
procedure Default; override;
protected
procedure Validate(Validation: TValidation); override;
published
[AbstractionField]
property Name: string read fName write fName;
[AbstractionField]
property Parent: Integer read fParent write fParent;
[AbstractionField]
property Comment: String read fComment write fComment;
end;
当我现在尝试通过 Delphi XE 中的高级 RTTI 获取有关信息时,我得到的结果是已发布属性的可见性信息,该结果告诉我它们只是公共的,而我添加的属性是根本没有出现。
那里发生了什么事?我已经尝试验证它是我尝试分析的正确类,并且当发生更改时,属于它的单元会被重新编译。这似乎不是问题。
I have in essence the following class in my application
TCategory = class(TAbstractionTreeItem)
private
fName: String;
fParent: Integer;
fComment: String;
public
procedure Default; override;
protected
procedure Validate(Validation: TValidation); override;
published
[AbstractionField]
property Name: string read fName write fName;
[AbstractionField]
property Parent: Integer read fParent write fParent;
[AbstractionField]
property Comment: String read fComment write fComment;
end;
When I now try to get information about through advanced RTTI in Delphi XE, I get as visibility information for the published properties a result that tells me they are only public and the attributes that I added are not showing up at all.
What is going on there? I already tried to validate that it is the right class that I try to analyse and that the unit that belongs to it is recompiled, when changes occur. That does not seem to be the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了让您的代码进行编译,我更改了以下内容:
然后我编写了以下代码来查询属性的可见性:
我的结果(如预期):
我也使用 Delphi XE,您将不得不提供更多代码,以便我们可以重复问题。
另请确保检查警告:
[DCC 警告] UnitName.pas(LineNum): W1025 不支持的语言功能:“自定义属性”
这是识别属性是否被错误输入且编译器无法找到的唯一方法。
In order to get your code provided to compile, i changed the following:
Then I wrote the following code to query the visibility of the properties:
My Results where (As Expected):
I am using Delphi XE as well, your going to have to provide more code so we can duplicate the problem.
Also make sure you check your warnings for:
[DCC Warning] UnitName.pas(LineNum): W1025 Unsupported language feature: 'custom attribute'
This is the only way to identify if an attribute is incorrectly entered and unable to be found by the compiler.