Possible incorrect sorting in KnownHeaders.cs
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
Hello,
Looks like there are some incorrect sorting operations in KnownHeader.cs.
Perhaps, there should be the .OrderBy(...).ThenBy(...)
invocation sequence instead of .OrderBy(...).OrderBy(...)
.
....
.Concat(corsRequestHeaders)
.OrderBy(header => header)
.OrderBy(header => !requestPrimaryHeaders.Contains(header))
.Select((header, index) => new KnownHeader
....
....
.Concat(corsResponseHeaders)
.OrderBy(header => header)
.OrderBy(header => !responsePrimaryHeaders.Contains(header))
.Select((header, index) => new KnownHeader
....
....
.OrderBy(header => header)
.OrderBy(header => !responsePrimaryHeaders.Contains(header))
.Select((header, index) => new KnownHeader
....
Expected Behavior
No response
Steps To Reproduce
No response
Exceptions (if any)
No response
.NET Version
No response
Anything else?
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Suspicious sortings in Unity, ASP.NET Core, and more
The sequence turned out to be sorted by the secondary key. But the sorting by primary key was not saved. If you've ever...
Read more >Suspicious sortings in Unity, ASP.NET Core, and more
The sequence turned out to be sorted by the secondary key. But the sorting by primary key was not saved. If you've ever...
Read more >Cannot sort table headers by ascending or descending
I am using jQuery jTable and sorting is enabled by default. Is is possible to do this by using a jQuery? Here's my...
Read more >Solved: Incorrect Sorting
Solved: Hello, Background: I am pulling data from an OData source. I find it strange that my data will no sort properly. See...
Read more >GridView.SortExpression Property (System.Web.UI. ...
The following example demonstrates how to use the SortExpression property to determine the name of the column being sorted. ASP.NET (C#)
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There isn’t a bug here;
OrderBy
does a stable sort and the secondOrderBy
in these cases just checks for presence in a set, so we always end up with the same result (specifically, one where the headers are in order and the primary ones come first).I suppose it would be slightly cleaner for us to first sort on set presence, then use
ThenBy
to sort by header which would accomplish the same thing.Closed with https://github.com/dotnet/aspnetcore/pull/40410