XML doc comment on extended partial method without body #4160
-
Inspired by dotnet/runtime#44969 (comment), I tried placing XML documentation comments in a separate file and hooking them up with extended partial methods (#3301, Docs). However, the C# compiler in .NET 5.0 SDK appears to ignore the XML documentation comment on the partial method declaration that does not have a body. Is this by design? partialdoc.csproj: <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
</Project> Class1.cs: using System;
namespace partialdoc
{
public partial class Class1
{
public partial void Method() => throw new NotImplementedException();
}
} Class1.docs.cs: namespace partialdoc
{
/// <summary>Class documentation.</summary>
partial class Class1
{
/// <summary>Method documentation.</summary>
public partial void Method();
}
} Build:
The resulting bin/Debug/net5.0/partialdoc.xml omits the "Method documentation" that was in Class1.docs.cs: <?xml version="1.0"?>
<doc>
<assembly>
<name>partialdoc</name>
</assembly>
<members>
<member name="T:partialdoc.Class1">
<summary>Class documentation.</summary>
</member>
</members>
</doc> |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
This works differently in .NET SDK 6.0.300. I now get: <?xml version="1.0"?>
<doc>
<assembly>
<name>partialdoc</name>
</assembly>
<members>
<member name="T:partialdoc.Class1">
<summary>Class documentation.</summary>
</member>
<member name="M:partialdoc.Class1.Method">
<summary>Method documentation.</summary>
</member>
</members>
</doc> even when targeting .NET 5.0. #6014 is related. |
Beta Was this translation helpful? Give feedback.
This works differently in .NET SDK 6.0.300. I now get:
even when targeting .NET 5.0.
#6014 is related.