Skip to content

XmlWriterSettings.NewLineChars defaults to "\n" on Linux, contrary to docs #8315

@KalleOlaviNiemitalo

Description

@KalleOlaviNiemitalo

Description

On Linux, the default value of XmlWriterSettings.NewLineChars is "\n", even though the documentation says it is "\r\n".

Reproduction Steps

PowerShell 7.2.5 using .NET 6.0.6 on Debian:

[System.Xml.XmlWriterSettings]::new().NewLineChars.GetEnumerator() | % { [int]$_ }

Expected behavior

Should output

13
10

Actual behavior

Outputs only

10

Regression?

I don't know

Known Workarounds

Assign XmlWriterSettings.NewLineChars after construction.

Configuration

.NET 6.0.6 on Debian 11.3 amd64.
The issue does not occur on Windows.

Other information

https://github.com/dotnet/runtime/blob/7cca709db2944a09b4db6ca7b20c457ff260fb5a/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlWriterSettings.cs#L159-L160

https://github.com/dotnet/runtime/blob/7cca709db2944a09b4db6ca7b20c457ff260fb5a/src/libraries/System.Private.Xml/src/System/Xml/Core/XmlWriterSettings.cs#L723

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions