-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Figure out XML docs for positional records #44571
Comments
From discussion on 7/15/2020, we're going to go with a minimalist approach to start:
|
Make sure that CS1591 (missing XML comments) is not reported for these carry-overs. |
Is further action needed by the compiler team for 16.8? |
@RikkiGibson Yes, we'd like to do (1) from plan above: "compiler will carry over tags from record types to constructor parameters". |
@jcouv is there currently any way to get the compiler not to throw the CS1591 warning other than doing a pragma warning disable? I've tried lots of options and usually they add even more warnings than just the CS1591. |
@buvinghausen The CS1591 is complaining that the properties don't have documentation. One solution at the moment is to use explicit properties ( |
@jcouv I understand the context of CS1591. I was hoping there was a workaround other than using explicit properties or not having any documentation (via pragma disable) at all. Bummer. Hopefully this gets sorted soon. Thank you for the clarification. |
Let's make sure that completion works properly on nominal records as well, particularly in the following scenarios analogous to method parameters: That is, typing a |
@jcouv Two questions
#pragma warning disable CS1572
#pragma warning disable CS1573
/// <summary>
/// Some summary...
/// </summary>
/// <param name="SomeNumber">SomeNumber xml doc string</param>
public record SomeRecord(int SomeNumber);
#pragma warning restore CS1572
#pragma warning restore CS1573 I would like to avoid writing, /// <summary>
/// Some summary...
/// </summary>
public record SomeRecord(int SomeNumber)
{
/// <summary>
/// SomeNumber xml doc string
/// </summary>
public int SomeNumber { get; } = SomeNumber; // workaround
} and just what for the above to work properly in a future compiler release
|
@maxild Yes, I think that's the best you can do in sdk-5.0.102. Tagging @marcpopMSFT to confirm: I expect the fix (ie. roslyn/compiler version 3.9) will be ship via .NET SDK With that fix, the following two forms will be allowed without pragma suppressions: /// <summary>Summary <paramref name="I1"/></summary>
/// <param name="I1">Description for I1</param>
public record C(int I1);
/// <summary>Summary</summary>
/// <param name="I1">Description for I1</param>
public record C(int I1)
{
/// <summary>Property summary</summary>
public int I1 { get; init; } = I1;
} |
@jcouv I added
Nice way to inspect compiler version dotnet /usr/share/dotnet/sdk/5.0.101/Roslyn/bincore/csc.dll -version
3.8.0-5.20570.14 (6559f38c) It would be sweet to add msbuild/nuget/roslyn version to |
I can confirm that the most recent version of Roslyn shipping with 5.0.2xx is 3.9.0-3.21056.4. I also filed a bug for your suggestion about including more information in dotnet --info on versions of the various tools included in the SDK. Good idea. |
@marcpopMSFT Thanks for your quick response...Looking forward to 5.0.2xx. 🚀
Can you send me a link to the issue, or is it internal? |
@maxild , do you see the link to dotnet/sdk#15496 above here in the GH UI? |
@marcpopMSFT Is there any way how to figure out in what Visual Studio version this will be available? Or will it be enough to install the right dotnet SDK and get the goodness even without VS update? |
@danstur This was fixed in Visual Studio 16.9 |
@jcouv and/or @marcpopMSFT I see here https://docs.microsoft.com/en-us/visualstudio/releases/2019/release-notes-preview that we are at preview5. But I couldn't find any info about when 16.9 will RTM? |
After using 5.0.200 released today the version is actually greater $ dotnet /usr/share/dotnet/sdk/5.0.200/Roslyn/bincore/csc.dll -version
3.9.0-5.21120.8 (accdcb77) |
Using the .Net SDK 5.0.1xx to document properties I was able to do:
I got a CS1587 warning that the XML comments were on invalid language elements but it still worked fine in the generated doc and I was able to suppress the warning, assuming it would later get fixed down the line to stop being emitted. In 5.0.2xx this doesn't work and the field descriptions aren't written to the XML doc. Could we reenable this form as well as the |
@jcouv I just tried it with VS 16.9.3 and it still seems to not work as expected. I guess I'm not using the correct syntax for the declaration? Using the following definitions:
The generated documentation file also does not include the information:
|
Same here, that is, the docs for the shorthand property are written as |
I just reproduced this behavior with 16.10.2. Please fix this, it would really make records more useful.
|
Same in 16.11.1, unfortunately. |
@danstur @InspiringCode @AgentFire Track issue #52663 for upcoming design change (aiming for 17.1). |
How do we specify xml docs for positional members (which define both parameters and properties)?
The text was updated successfully, but these errors were encountered: