Skip to content

[AOT] Add safe route value overloads to Results and TypeResults #46229

Closed
@JamesNK

Description

@JamesNK

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

#46082 annotates Microsoft.AspNetCore.Http.Results for trimming and AOT.

The route result methods have object parameters that are turned into RouteValuesDictionary. This is done with reflection and isn't safe with trimming.

Describe the solution you'd like

A couple of options:

  • Add overloads that take RouteValuesDictionary. This is what we do with LinkGenerator and in other places.
  • Add generic overloads with DAM attribute to keep everything.
    • Experiments show that this could be a source-breaking change.
    • Also, DAM attribute won't work with polymorphism. Reflection uses the type of the instance, while the DAM attribute won't preserve properties if the reference is typed as something else. e.g. a Person instance could be passed to the method as object, so Person properties aren't preserved.

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions