Skip to content

Make RDG handle names that are escaped keywords #48248

Open
@amcasey

Description

@amcasey

When we generate code containing user-defined names (e.g. using typeof on the type of a parameter), we need to be careful to generate syntactically valid code in the presence of escaped keywords like @class.

Ah! I misinterpreted your comment a little bit. I thought your inquiry was around the use of the @ prefix on class names in general (which ends up producing something like typeof(MyClass) which is valid) but you were referring to the literal use of class @class.

My initial reaction to this is that it's the kind of edge case that I'd be comfortable not addressing specifically in RDG.

My second reaction is to explore what the implementation complexity would look like with this and see if it is worth pursuing given cost/reward. It might very well be we have to pass a formatter to ToDisplayString here to get the desired behavior.

My third reaction is wondering if the current behavior (compiler errors on generated code) is a valid experience for users who run into these kinds of buggy experiences.

In any case, this is worth tracking in a follow-up issue if you'd like to file one?

Originally posted by @captainsafia in #47914 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-rdg

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions