Repository navigation
Use explicit LF line endings in PLIST_HEADER - #200
Conversation
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>
There was a problem hiding this comment.
🟢 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
\nescapes. - 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
|
@dalexsoto review |
dalexsoto
left a comment
There was a problem hiding this comment.
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.
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>
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>
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