Changing templating system from XmlDocument based to XDocument based#946
Open
michelebastione wants to merge 3 commits intomini-software:masterfrom
Open
Changing templating system from XmlDocument based to XDocument based#946michelebastione wants to merge 3 commits intomini-software:masterfrom
michelebastione wants to merge 3 commits intomini-software:masterfrom
Conversation
- Changed `OpenXmlZip` to make use of `ZipArchive`'s asynchronous `CreateAsync` and `DisposeAsync` methods by adding an asynchronous factory method and the IAsyncDisposable implementation - Updated all entry points for `OpenXmlZip` and `ZipArchive` in all methods across the codebase - Added `SynchronousHelper` with extension methods for ensuring compatibility with the SyncMethodGenerator - Other minor code cleanups
… the XmlDocument based one
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the OpenXml template engine to use XDocument and XElement instead of XmlDocument, introduces asynchronous initialization for ZIP archives, and improves cross-framework compatibility. While the migration to System.Xml.Linq modernizes the codebase, several critical issues were identified: a variable corruption bug in the XML writing loop, the destruction of XML structure when handling merged cells via XElement.Value, and a performance bottleneck in formula processing due to redundant XML round-trips. Furthermore, a regression in ZIP entry lookups introduced case-sensitivity, and unsafe attribute access poses a risk of null reference exceptions.
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.
This PR swaps the templating system implementation, currently based on the use of
XmlDocument, with one based on the more modern, more readable andLINQ-supportingXDocument.It also improves on the implementation of the
OpenXmlZipclass to make better use of the new .NET 10'sZipArchive's async API throughout the codebase.Resolves #758
Resolves #804