question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CS1584, CS1658 from `inheritdoc cref` when referencing method with value tuple parameter

See original GitHub issue

When <inheritdoc cref="..."/> refers to a member with a parameter whose type is a ValueTuple intrinsic, the completion list will help select the member while typing the cref attribute’s value, but then C# will emit several warnings around the xml being invalid and the member not being found.

Repro on SharpLab.io

using System;
public class C {
    /// <param name="progress"><inheritdoc cref="M2(IProgress{int})" path="/param[@name='progress']" /></param>
    public void M(IProgress<int> progress) {
    }
    
    /// <param name="progress">Some progress</param>
    private void M2(IProgress<int> progress) {
    }
    
    /// <param name="progress"><inheritdoc cref="N(IProgress{(int,int)})" path="/param[@name='progress']" /></param>
    public void N(IProgress<int> progress) {
    }
    
    /// <param name="progress">Some progress</param>
    private void N2(IProgress<(int,int)> progress) {
    }    
}

Expected

no warnings

Actual

warning CS1584: XML comment has syntactically incorrect cref attribute 'N(IProgress{(int,int)})'
warning CS1658: Identifier expected. See also error CS1001.
warning CS1658: Syntax error, '>' expected. See also error CS1003.
warning CS1658: ) expected. See also error CS1026.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bfrencommented, May 7, 2021

I solved this by removing the argument types in the cref, e.g.

/// <inheritdoc cref="QueryOptions.AddJoin{TFrom, TTo}(QueryParts, (TFrom table, Expression{Func{TFrom, string}} column), (TTo table, Expression{Func{TTo, string}} column), Func{QueryParts, IColumn, IColumn, QueryParts})"/>

to

/// <inheritdoc cref="QueryOptions.AddJoin"/>

Which has the advantage of being significantly easier to read - though doesn’t work when there are multiple overrides.

0reactions
zp-zpandacommented, Jan 13, 2023

Ya, that makes sense @zp-zpanda. Thanks for the workaround. This is still a bug though, at least for this part:

the completion list will help select the member while typing the cref attribute’s value

So the completion list itself is providing a faulty completion.

Yes, this is a possible workaround but docfx doesn’t work with it for me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to use `<inheritdoc cref="...">` when one of ...
when one of the parameters have the `in` keyword? ... Is it possible to use inheritdoc referencing a method with an in parameter?...
Read more >
Using the <inheritdoc /> Tag
Be aware that when <param> tags are inherited, the parameter's name in your class's member must match the base member's parameter name. If...
Read more >
Tuple Trouble: Why C# Tuples Get to Break the Guidelines
Technically, System.ValueTuple<…> is a family of data types of the same name, but of varying arity (specifically, the number of type parameters). What's ......
Read more >
Cannot Convert The Literal '2 To The Expected Type 'edm.guid'.
Consider changing the 'Embed Interop Types' property on either assembly. CS1763, Error, '{0}' is of type '{1}'. A default parameter value of a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found