Skip to content

Conversation

@davidfowl
Copy link
Member

  • For error handling cases, we were doing a case sensitive match against route parameters instead of a case insensitive one.
  • Added tests

Fixes #35087

- For error handling cases, we were doing a case sensitive match against route parameters instead of a case insensitive one.
- Added tests
@ghost ghost added the area-runtime label Aug 6, 2021
@davidfowl davidfowl added old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels feature-minimal-actions Controller-like actions for endpoint routing and removed area-runtime labels Aug 6, 2021
if (parameterCustomAttributes.OfType<IFromRouteMetadata>().FirstOrDefault() is { } routeAttribute)
{
if (factoryContext.RouteParameters is { } routeParams && !routeParams.Contains(parameter.Name))
if (factoryContext.RouteParameters is { } routeParams && !routeParams.Contains(parameter.Name, StringComparer.OrdinalIgnoreCase))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this using Linq? Can we turn this in to HashSet instead? or write a bespoke iterator? The Linq one will result in allocations: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Linq/src/System/Linq/Contains.cs#L33

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do that in another PR and did all the things. But I agree with you. There's too much LINQ usage here at startup

Copy link
Contributor

@pranavkm pranavkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests look great. I know it's a one time cost, but the Linq allocations appears at Startup for a whole slew of data types / parameters and it would be great if we can avoid these allocations.

@davidfowl
Copy link
Member Author

We should file another item to measure and fix the low hanging startup performance fruit here

@davidfowl davidfowl merged commit fd94970 into main Aug 6, 2021
@davidfowl davidfowl deleted the davidfowl/case-sensitivity branch August 6, 2021 17:08
@ghost ghost added this to the 6.0-rc1 milestone Aug 6, 2021
@amcasey amcasey added the area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc label Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc feature-minimal-actions Controller-like actions for endpoint routing old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ignore Casing for route parameters in Minimal APIs

4 participants