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] <inheritdoc /> + <typeparamref > = empty string (and warning) #8948

Closed
JeReT opened this issue Jul 9, 2023 · 4 comments · Fixed by #8975 or dotnet/roslyn#70230
Closed

[Bug] <inheritdoc /> + <typeparamref > = empty string (and warning) #8948

JeReT opened this issue Jul 9, 2023 · 4 comments · Fixed by #8975 or dotnet/roslyn#70230
Labels
bug A bug to fix dotnet Generate .NET API reference docs

Comments

@JeReT
Copy link

JeReT commented Jul 9, 2023

Describe the bug
When you have an <inheritdoc/> for a generic method which references a generic parameter via <typeparamref /> in the tripple-slash-comment, a warning is shown when serving and the generic type name is not shown in the documentation at all.

Here a test scenario:

    public interface IMyInterface
    {
        /// <summary>
        /// Does nothing with generic type <typeparamref name="T"/>.
        /// </summary>
        /// <typeparam name="T">A generic type.</typeparam>
        void DoNothing<T>();
    }

    public class MyImplementation : IMyInterface
    {
        /// <inheritdoc/>
        public void DoNothing<T>() { }
    }

and here the output in the console:

Invalid cref value "!:T" found in triple-slash-comments for DoNothing defined in ...

and a screenshot from the documentation:
grafik

To Reproduce
Steps to reproduce the behavior:

  1. Copy the code above into a C# project
  2. Setup docfx to create a documentation for that project
  3. Serve the docfx project

Expected behavior

  • No warning should be shown.
  • The Type parameter name should appear in the generated documentation and it should act as a cross reference to the documentation of the type parameter.

Context (please complete the following information):

  • OS: Windows 10
  • Docfx version: 2.67.5

Additional context
If I don't use <inheritdoc/> and instead copy-paste the documentation, everything works as expected.
It doesn't seem to matter if the <typeparamref> occures in the summary tag or somewhere else.

@JeReT JeReT added the bug A bug to fix label Jul 9, 2023
@yufeih yufeih added the dotnet Generate .NET API reference docs label Jul 10, 2023
@yufeih
Copy link
Contributor

yufeih commented Jul 17, 2023

vs/vscode in this case does not render T in MyImplementation with a clickable link, so it did failed to resolve that T but we should fallback to display the T instead of showing an empty string. Might be related to #1887.

@KerenSl-tr
Copy link

It seems that you fixed the problem of displaying the type reference as an empty string, but still the warning appears and the displayed reference doesn't act as a link:
image

And there's still a warning:

warning: Invalid cref value "!:T" found in XML documentation comment  for Execute defined in ...

I think this bug should be reopened until these issues are also solved.

@KerenSl-tr
Copy link

Note: we want to add --warningsAsErrors in our build pipeline, but this warning prevents us from doing so. Please advise even if there's a workaround until this bug is resolved.

@filzrev
Copy link
Contributor

filzrev commented Mar 19, 2024

This issue will be resolved in next docfx release. (By Roslyn packages update)

I've tested on nightly version of docfx.
And confirmed it works as expected.

@yufeih yufeih closed this as completed Mar 19, 2024
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
4 participants