Area-CompilersBughelp wanted
説明
Version Used:
dotnet --version reports: 2.1.200
Steps to Reproduce:
dotnet new libraryto create a new library project- Add a
DocumentationFileelement to the csproj'sPropertyGroupelement:
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\$(AssemblyName).xml</DocumentationFile>
- Add a code example to the triple slash, where the
codetag contains aCDATAsection
using System;
namespace csdoccomment
{
/// <summary>This is the Summary</summary>
/// <example>
/// <code language="c#">
/// <![CDATA[
/// // No Indent
/// // four spaces
/// /// eight spaces
/// ]]>
/// </code>
/// </example>
public class Class1
{
}
}
- Compile with
dotnet build
Expected Behavior: I would expect the CDATA section to retain the expected level of indention as when authored, relative to the triple slash delimiter ... so the XML file should look as such
<?xml version="1.0"?>
<doc>
<assembly>
<name>csdoccomment</name>
</assembly>
<members>
<member name="T:csdoccomment.Class1">
<summary>This is the Summary</summary>
<example>
<code language="c#">
<![CDATA[
// No Indent
// four spaces
/// eight spaces
]]>
</code>
</example>
</member>
</members>
</doc>
Actual Behavior:
However, as you can see, the contents of the CDATA element are indented relative to the indent level of the parent XML tag.
<?xml version="1.0"?>
<doc>
<assembly>
<name>csdoccomment</name>
</assembly>
<members>
<member name="T:csdoccomment.Class1">
<summary>This is the Summary</summary>
<example>
<code language="c#">
<![CDATA[
// No Indent
// four spaces
/// eight spaces
]]>
</code>
</example>
</member>
</members>
</doc>
The contents of the CDATA section are meant to respect the whitespace ... and in many cases, whitespace can be significant, especially when we're talking about code examples for languages like python or F#.
/cc @dend, @terrajobst