Skip to content

[C#] Compile error - Getter tries to return null for newly introduced Enum property #661

Closed
@EddPorter

Description

@EddPorter

When a template specification introduces a new property with an Enum return type, the generated code checks the ActingVersion and outputs "return null" if it is too low. This doesn't compile.

public AttribValue AttribValue
{
  get
  {
    if (_actingVersion < 3) return null; // compile error

    return (AttribValue)_buffer.Uint32GetLittleEndian(_offset + 0);
  }
... setter
}

From schema file:

<set name="AttribValue" encodingType="uInt32" sinceVersion="3">
            <choice name="FirstChoice" description="The first choice">0</choice>
...
</set>

Should the return type be AttribValue? as a fix?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions