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

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

Closed
1 task done
JamesNK opened this issue Jan 24, 2023 · 1 comment · Fixed by #46594
Closed
1 task done

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

JamesNK opened this issue Jan 24, 2023 · 1 comment · Fixed by #46594
Assignees
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels linker-friendliness Tracking linker friendliness NativeAOT
Milestone

Comments

@JamesNK
Copy link
Member

JamesNK commented Jan 24, 2023

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

@JamesNK JamesNK added linker-friendliness Tracking linker friendliness NativeAOT area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels labels Jan 24, 2023
@rafikiassumani-msft rafikiassumani-msft added this to the 8.0-preview1 milestone Jan 24, 2023
@captainsafia
Copy link
Member

Triage: Need an API review template for this:

Add overloads that take RouteValuesDictionary. This is what we do with LinkGenerator and in other places.

@captainsafia captainsafia moved this from Todo to In Progress in [.NET 8] Web Frameworks Feb 14, 2023
@captainsafia captainsafia moved this from In Progress to Done in [.NET 8] Web Frameworks Feb 21, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels linker-friendliness Tracking linker friendliness NativeAOT
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants