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

[Bug] Generic methods / types are not ordered correctly together with their non-generic versions #10332

Open
mikernet opened this issue Oct 30, 2024 · 3 comments
Labels
bug A bug to fix dotnet Generate .NET API reference docs

Comments

@mikernet
Copy link
Contributor

Describe the bug
Title says it all. Examples:

Image

Image

Expected behavior
Generic types/methods should follow immediately after non-generic ones with the same name.

Context (please complete the following information):

  • OS: Windows
  • Docfx version: 2.77.0
  • .NET version: .net 8
@mikernet mikernet added bug A bug to fix dotnet Generate .NET API reference docs labels Oct 30, 2024
@filzrev
Copy link
Contributor

filzrev commented Oct 30, 2024

It seems to be occurred when using "outputFormat": "mref" options.
When using apiPage or markdown options. It works as expected.

I though it's introduced by enabling InvariantGlobalization mode. (#8893)
I'll try to create PR to fix reported issue later.

Background
Currently toc items are sorted by uid.
And when item contains generic type parameter it's represented as "`1".

But when toc items are sorted with Ordinal order.
The order of results is changed from what is expected.

Sample TOC file

  - uid: BuildFromProject.IRoutedView
    name: IRoutedView
  - uid: BuildFromProject.IRoutedViewModel
    name: IRoutedViewModel
  - uid: BuildFromProject.IRoutedView`1
    name: IRoutedView<T>

@mikernet
Copy link
Contributor Author

So based on your comment, does that mean that there is a workaround that I can use for now (something that won't radically change how I need to generate the docs)?

@filzrev
Copy link
Contributor

filzrev commented Oct 30, 2024

A temporary workaround is to disable globalization nvariant mode.

1. Steps to disableInvariantModesettings

  1. Open following file. (On Windows environment)

    %UserProfile%\.dotnet\tools\.store\docfx\2.77.0\docfx\2.77.0\tools\net8.0\any\docfx.runtimeconfig.json

  2. Modify System.Globalization.Invariant setting to false.

2. Steps to confirm behavior changes

  1. Run docfx metadata command.
  2. Run docfx build --serve command
  3. Confirm TOC displayed orders.

To fix the root cause problems.
It need to create Custom IComparer<string> that compatible with InvariantCulture(with System.Globalization.Invariant: false)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug to fix dotnet Generate .NET API reference docs
Projects
None yet
Development

No branches or pull requests

2 participants