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] .NET API bug Property Value content not render correctly in generated Markdown #10489

Open
cary-hu opened this issue Dec 31, 2024 · 1 comment
Labels
bug A bug to fix dotnet Generate .NET API reference docs

Comments

@cary-hu
Copy link

cary-hu commented Dec 31, 2024

I have a Class with comment like this:

namespace ClassLibrary1
{
    /// <summary>
    /// This is a test class
    /// </summary>
    /// <seealso cref="System.Object"/>
    public class Class1
    {
        /// <summary>
        /// This is a test summary
        /// </summary>
        /// <value>
        /// <see langword="string"/> is test
        /// </value>
        public string TestStringProperty { get; set; }

    }
}

After build, I will got two files ClassLibrary1.dll and ClassLibrary1.xml, xml will with this content:

<?xml version="1.0"?>
<doc>
    <assembly>
        <name>ClassLibrary1</name>
    </assembly>
    <members>
        <member name="T:ClassLibrary1.Class1">
            <summary>
            This is a test class
            </summary>
            <seealso cref="T:System.Object"/>
        </member>
        <member name="P:ClassLibrary1.Class1.TestStringProperty">
            <summary>
            This is a test summary
            </summary>
            <value>
            <see langword="string"/> is test
            </value>
        </member>
    </members>
</doc>

Expected behavior

all the content should be rendered in generated markdown page.

but, the property value is not rendered correctly:
Image

Context (please complete the following information):

  • OS: Windows

  • Docfx version: 2.78.2

  • .NET version: .NET 8.0

  • docfx.json config

{
    "metadata": [
        {
            "src": [
                {
                    "files": [
                        "*.dll"
                    ]
                }
            ],
            "dest": "./api",
            "outputFormat": "markdown"
        }
    ]
}
@cary-hu cary-hu added bug A bug to fix dotnet Generate .NET API reference docs labels Dec 31, 2024
@filzrev
Copy link
Contributor

filzrev commented Dec 31, 2024

I also confirmed reported issue can be reproduced.

It seems occurred when using apiPage or markdown output format.

It occurred because following lines don't set description property for Parameter type.
And it seems be resolved by adding description = comment.Returns, line.
https://github.com/dotnet/docfx/blob/main/src/Docfx.Dotnet/DotnetApiCatalog.ApiPage.cs#L559-L566

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