Conversation
Release notes containing XML special characters (specifically ampersands) would cause System.Xml.XmlException during package creation when the nuspec file was parsed. This fix ensures all release notes content is properly escaped using SecurityElement.Escape() before being added to the nuspec XML. For any content that remains invalid after escaping, it falls back to CDATA wrapping with proper handling of ]]> sequences. Added comprehensive unit tests that validate the escaping logic works correctly for all problematic content including XML chars, unicode, control characters, CDATA-like sequences, and very long content. Fixes #666
Previous approach used SecurityElement.Escape() which converted special characters like & to &, < to <, etc. This caused content to be altered when round-tripped through the package - users would see & instead of & in their release notes. CDATA treats all content as literal text, so no escaping is needed. Only special case is ]]> which terminates CDATA - split it into ]]]]><![CDATA[> to preserve the sequence. - Remove SecurityElement.Escape() from PackageBuilder.addMetadata() - Always wrap content in CDATA - Add unit tests verifying ]]> preservation and no double-escaping - Fixes #666
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #774 +/- ##
===========================================
+ Coverage 42.76% 43.28% +0.51%
===========================================
Files 258 258
Lines 19532 19590 +58
Branches 2122 2122
===========================================
+ Hits 8353 8479 +126
+ Misses 10798 10722 -76
- Partials 381 389 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Closes #666
Closes #758