Repository navigation
Fix plist parsing after long-form boolean elements - #203
Merged
Merged
Conversation
Consume the whole boolean element so its closing tag does not end the containing dictionary or array. Cover both boolean values with short, long, and whitespace-containing XML forms. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the XML plist boolean parsing change.
No open issues 🎉
What changed in this PR
Fixes XML plist boolean parsing in Xamarin.MacDev so long-form boolean elements do not prematurely end the containing dictionary or array.
Changes:
- Uses
XmlReader.Skip()to consume the entire boolean element. - Adds dictionary and array regression tests for self-closing, explicit closing-tag, and whitespace-containing forms of both boolean values.
| File | Description |
|---|---|
| Xamarin.MacDev/PListObject.cs | Consumes complete boolean elements to preserve parsing of subsequent entries. |
| tests/PListObjectTests.cs | Verifies boolean values and subsequent entries across six XML forms in dictionaries and arrays. |
Review effort: Balanced
rolfbjarne
enabled auto-merge (squash)
November 20, 2026 16:58
Member
Author
|
@dalexsoto review |
dalexsoto
approved these changes
Nov 20, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
Reviewed d90f3bc2 against main at 4490e9b6. This is a static, read-only review.
- Root cause:
ReadBoolwas the only XML value reader that advanced the reader by hand. On a long-form<true></true>/<false></false>,Read()left the reader on the closing tag, soReadDictbroke out early, failed itsdictend-tag check and returnedfalse, whichReadObjectignores. Every later key or array item was silently dropped (the dotnet/macios#27414 Firebase plist). - The fix:
ReadBoolis only reached fromReadObjectwith the reader on the<true>/<false>element (callers: the constructor,ReadArrayandReadDictall check for an element first). On that elementSkip()behaves likeRead()for<true/>, and for<true></true>or<true>\n\t</true>it moves past the matching end tag (whitespace nodes are not ignored by these reader settings, so they are consumed with the element). The following dict/array loops and their end-tag checks then line up. - Other value types (integer, real, date, data, string) already use
ReadElementContentAs*, and empty<dict>/<array>are handled, so booleans were the only affected type. The binary reader does not move the stream for booleans and is unaffected. - Tests:
PObject.FromStringfalls through to the XML reader for<-prefixed input, so both new tests exercise the fixed path. The long-form cases would fail on the count assertion without the fix, and the self-closing cases guard against regressions. The APIs they use exist. - Non-blocking: content inside a boolean element is now ignored. Apple's parser rejects
<true> </true>, so the whitespace cases accept slightly more than CoreFoundation does. That is harmless and much better than truncating the container.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Consume the whole boolean element so its closing tag does not end the containing dictionary or array. Add tests for
<true/>,<true></true>, and<true> </true>, and the same forms for<false>.Fixes dotnet/macios#27414
Note
This pull request was generated by Copilot.