Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access violation using Enumerated Types with Explicitly Assigned Ordinality #4

Closed
Himhotep opened this issue Oct 30, 2019 · 1 comment

Comments

@Himhotep
Copy link

To test it you only have to change
TEnumSpeed = (Low, Medium, High);
to
TEnumSpeed = (Low=1, Medium=2, High=3);
in Demo.Neon.Entities unit. Then press TMyRecord button.

@paolo-rossi
Copy link
Owner

Hi there,

sorry it took me so long to reply... anyway, regarding the issue:

Delphi does not generate Rtti information for enum types with explicit ordinality, to verify please write this line in both cases:

var
  LSpeedType TRttiType;
begin
  LSpeedType := LContext.GetType(TypeInfo(TEnumSpeed));

You'll see that in the second case Delphi complains that:

[dcc32 Error] Unit3.pas(50): E2134 Type 'TEnumSpeed' has no type info

So, I'm afraid I will not be able to serialize these type of enum, but regarding the access violation, I will try to handle the returning nil TRttiType skipping the particular member.

Ciao,
Paolo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants