Skip to content

StringSort does not work as described in the docs  #9014

@ilonatommy

Description

@ilonatommy
Member

.NET 7, Console App, but actually it happens for net6, net 5, net core 3.1 as well. The last dotnet that works as the docs is framework 4.7.2, so it looks like it's by design.

This is what docs claim to happen (see the comment in the end of the example):
https://learn.microsoft.com/en-us/dotnet/api/system.globalization.compareoptions?view=net-7.0#examples

While this is what is happening:

Initially,
cant
bill's
coop
cannot
billet
can't
con
bills
co-op

After sorting without CompareOptions.StringSort:
bill's
billet
bills
can't
cannot
cant
co-op
con
coop

After sorting with CompareOptions.StringSort:
bill's
billet
bills
can't
cannot
cant
co-op
con
coop

Most probably there was copy-paste error. In case it is not by design, we need to fix it.

Activity

ghost added
untriagedNew issue has not been triaged by the area owner
on May 17, 2023
ghost

ghost commented on May 17, 2023

@ghost

Tagging subscribers to this area: @dotnet/area-system-globalization
See info in area-owners.md if you want to be subscribed.

Issue Details

.NET 7, Console App, but actually it happens for net6, net 5, net core 3.1 as well. The last dotnet that works as the docs is framework 4.7.2, so it looks like it's by design.

This is what docs claim to happen (see the comment in the end of the example):
https://learn.microsoft.com/en-us/dotnet/api/system.globalization.compareoptions?view=net-7.0#examples

While this is what is happening:

Initially,
cant
bill's
coop
cannot
billet
can't
con
bills
co-op

After sorting without CompareOptions.StringSort:
bill's
billet
bills
can't
cannot
cant
co-op
con
coop

After sorting with CompareOptions.StringSort:
bill's
billet
bills
can't
cannot
cant
co-op
con
coop

Most probably there was copy-paste error. In case it is not by design, we need to fix it.

Author: ilonatommy
Assignees: -
Labels:

doc-bug, area-System.Globalization

Milestone: -
tarekgh

tarekgh commented on May 17, 2023

@tarekgh
Member

This is a difference in the collation behavior between ICU and NLS. Mostly how the quotation is sorted.

NLS result

After sorting without CompareOptions.StringSort: billet, bills, bill's, cannot, cant, can't, con, coop, co-op

while ICU Result

After sorting without CompareOptions.StringSort: bill's, billet, bills, can't, cannot, cant, co-op, con, coop
added this to the Backlog milestone on May 17, 2023
ghost removed
untriagedNew issue has not been triaged by the area owner
on May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Pri3Indicates issues/PRs that are low priorityarea-System.Globalizationdoc-bugProblem with the content; needs to be fixed

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tarekgh@ilonatommy

        Issue actions

          `StringSort` does not work as described in the docs · Issue #9014 · dotnet/dotnet-api-docs