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 with ValueTuple handling #8695

Open
Aragas opened this issue Apr 27, 2023 · 1 comment
Open

[Bug] .NET API bug with ValueTuple handling #8695

Aragas opened this issue Apr 27, 2023 · 1 comment
Labels
dotnet Generate .NET API reference docs

Comments

@Aragas
Copy link

Aragas commented Apr 27, 2023

Describe the bug
ValueTuple brings some unexpected behaviour for DocFX reference API generation.
DocFX does ReferenceItem merging, but when the ValueTuple is not default - has custom named symbol names

[return: TupleElementNames(new string[] { "name", "value" })]
ValueTuple<string, int> GetCompanionWithMostKills();

So instead on an unnamed ValueTuple (string, int) we got string name, int item.
This breaks two asserts

Debug.Assert(sourceParts.Count == targetParts.Count);

Debug.Assert(sourceParts[i].Name == targetParts[i].Name);

The first one breaks because there are now additional NameParts, the second breaks because for the same ValueTuple signature there can exist different name pairs (string something_else, int something_else2)

To Reproduce
Steps to reproduce the behavior:
Have a signature like

[return: TupleElementNames(new string[] { "name", "value" })]
ValueTuple<string, int> GetCompanionWithMostKills();
[return: TupleElementNames(new string[] { "name", "value2" })]
ValueTuple<string, int> GetCompanionWithMostElse();

Expected behavior
I didn't check the consequences, but I assume it might fail to correctly show the custom parameter names in some cases

Context (please complete the following information):

  • OS: Windows

  • Docfx version: 2.66.2

  • .NET version: .NET 7.0

  • docfx.json config:
    Not needed

  • Exceptions
    Not needed

  • Errors and warnings
    Not needed

  • .NET info
    Not needed

Additional context
Not needed

@Aragas Aragas added bug dotnet Generate .NET API reference docs labels Apr 27, 2023
@yufeih
Copy link
Contributor

yufeih commented Apr 28, 2023

Display of returns would be wrong, due to how docfx today stores and renders type signatures.

image

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

No branches or pull requests

2 participants