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] Unmanaged constraint is shown as "struct" #8764

Closed
jo3w4rd opened this issue May 12, 2023 · 4 comments · Fixed by #8773
Closed

[Bug] Unmanaged constraint is shown as "struct" #8764

jo3w4rd opened this issue May 12, 2023 · 4 comments · Fixed by #8773
Labels
bug A bug to fix dotnet: csharp New features requires to handle C#

Comments

@jo3w4rd
Copy link
Contributor

jo3w4rd commented May 12, 2023

Describe the bug
A generic method that has an unmanaged constraint is displayed in the generated docs as having a struct constraint.

To Reproduce
Function definition:

   /// <summary>Generic function with unmanaged constraint</summary>
    public T UnmanagedFunctionConstraint<T>(T t) where T: unmanaged
    {
        return t;
    }

Docs:

Generic function with unmanaged constraint

Declaration
public T UnmanagedFunctionConstraint<T>(T t)
    where T : struct
(etc...)

Expected behavior
The constraint in the generated docs would match the code.

Context (please complete the following information):

  • OS: Windows
  • Docfx version: tested on 2.58.9 and 2.63.0

Additional information
The error is present in the generated YAML file for the method:

  syntax:
    content: >-
      public T UnmanagedFunctionConstraint<T>(T t)
          where T : struct
    parameters:
    - id: t
      type: '{T}'
    typeParameters:
    - id: T
    return:
      type: '{T}'
    content.vb: Public Function UnmanagedFunctionConstraint(Of T As Structure)(t As T) As T
@jo3w4rd jo3w4rd added the bug A bug to fix label May 12, 2023
@jo3w4rd
Copy link
Contributor Author

jo3w4rd commented May 12, 2023

To make sure the problem wasn't with our (rather complex) projects, I made a new docfx project (docfx init -q) and created a C# project containing one class that had a single method in the src folder. The problem reproduces in this simple project.

I've attached the project here
docfx_project.zip

@yufeih yufeih added the dotnet: csharp New features requires to handle C# label May 16, 2023
@yufeih
Copy link
Contributor

yufeih commented May 16, 2023

This doesn't seem to repro in the latest version. I can see the unmanaged constraint:

image

@jo3w4rd
Copy link
Contributor Author

jo3w4rd commented May 16, 2023

You are correct, it seems to be fixed as of 2.61.0. (I found I had a chocolatey install of DocFX that took precedence over the dotnet tool install of 2.63.0.)

@yufeih
Copy link
Contributor

yufeih commented May 17, 2023

Thank you for confirming the fix.

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: csharp New features requires to handle C#
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants