Skip to content

Use explicit LF line endings in PLIST_HEADER - #200

Merged
rolfbjarne merged 1 commit into
mainfrom
dev/rolf/plist-header-lf
Nov 13, 2026
Merged

rolfbjarne merged 1 commit into
mainfrom
dev/rolf/plist-header-lf

Conversation

@rolfbjarne

Copy link
Copy Markdown
Member

When PListObject.cs is checked out with CRLF line endings on Windows,
the multi-line verbatim string literal PLIST_HEADER embeds \r\n into
the compiled assembly, while the rest of XmlFormat explicitly writes \n.
Apple's AMFI XML parser in codesign rejects CR characters in .xcent
entitlements files with 'AMFIUnserializeXML: syntax error near line 1'.

Use explicit \n escapes in PLIST_HEADER so XML plists always use LF
regardless of the checkout's line endings, and stop stripping \r\n from
the serialized output in TestIntegerXmlSerialization.

Note

🤖 Pull request created by Copilot

When PListObject.cs is checked out with CRLF line endings on Windows,
the multi-line verbatim string literal PLIST_HEADER embeds \r\n into
the compiled assembly, while the rest of XmlFormat explicitly writes \n.
Apple's AMFI XML parser in codesign rejects CR characters in .xcent
entitlements files with 'AMFIUnserializeXML: syntax error near line 1'.

Use explicit \n escapes in PLIST_HEADER so XML plists always use LF
regardless of the checkout's line endings, and stop stripping \r\n from
the serialized output in TestIntegerXmlSerialization.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the plist header line-ending change.

No open issues 🎉

What changed in this PR

Makes XML plist headers independent of checkout line endings, preventing Windows CRLF checkouts from introducing carriage returns that Apple's codesign parser rejects.

Changes:

  • Replace the multiline verbatim header with strings containing explicit \n escapes.
  • Stop normalizing serialized output in the integer XML test so unexpected carriage returns cause a failure.
File Description
Xamarin.MacDev/​PListObject.cs Use explicit LF line endings in PLIST_HEADER.
tests/​PListObjectTests.cs Compare serialized output without normalizing its line endings.

Review effort: Balanced

@rolfbjarne

Copy link
Copy Markdown
Member Author

@dalexsoto review

@dalexsoto dalexsoto left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new PLIST_HEADER is character-for-character the LF form of the old verbatim string. It is used only by XmlFormat.StartWriting, and the rest of the XML writer already emits explicit '\n' (Context.WriteLine and the closing ), so ToXml/ToByteArray/Save now produce LF-only output on every platform. The plist marker detection and the readers don't depend on the header's newlines. The test change is consistent: the expected resource is still normalized and the actual output is compared raw.

This was a static review; I did not build or run the tests.

@rolfbjarne
rolfbjarne merged commit 718b041 into main Nov 13, 2026
8 checks passed
rolfbjarne added a commit to dotnet/macios that referenced this pull request Nov 13, 2026
Xamarin.Apple.Tools.MaciOS now emits LF line endings in PLIST_HEADER
(dotnet/macios-devtools#200), so the workaround in CompileEntitlements
is no longer needed.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
rolfbjarne added a commit to dotnet/macios that referenced this pull request Nov 24, 2026
Update Xamarin.MacDev to include the fix from dotnet/macios-devtools#203. The parser now reads complete `<true></true>` and `<false></false>` elements, keeping all following entries when converting plist resources to binary.

The dependency update also includes:

* dotnet/macios-devtools#198: add plist-loading overloads that return errors.
* dotnet/macios-devtools#200: use LF line endings in XML plist headers.
* dotnet/macios-devtools#201: update CI.
* dotnet/macios-devtools#202: check all profiles in both provisioning-profile folders when selecting one.

Add a regression test that converts plists with both boolean values to binary and checks that no entries are lost.

Fixes #27414

🤖 Pull request created by Copilot

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rokvin@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants