Repository navigation
NativeAOT | Remove DataSet.ReadXml, correct type name - #3369
Merged
Merged
Conversation
This removes a reference to the built-in XML deserialization, which is slower and isn't trim-safe
mdaigle
reviewed
May 21, 2025
mdaigle
left a comment
Contributor
There was a problem hiding this comment.
A few questions to help with my understanding
paulmedynski
requested changes
May 22, 2025
paulmedynski
left a comment
Contributor
There was a problem hiding this comment.
Asking for some clarification on why we're reading this XML at runtime.
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
paulmedynski
approved these changes
May 22, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3369 +/- ##
==========================================
- Coverage 65.12% 62.22% -2.90%
==========================================
Files 300 294 -6
Lines 65379 65183 -196
==========================================
- Hits 42578 40563 -2015
- Misses 22801 24620 +1819
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mdaigle
approved these changes
May 23, 2025
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.
Description
This PR's diff is much smaller than it looks! There's an embedded XML resource, and adjusting this meant that the indentation levels changed. When that's accounted for, the PR becomes much smaller - around 300 lines, rather than 7800.
This PR relates to #1942 and #1261. At present, there are two identical copies of the
Microsoft.Data.SqlClient.SqlMetaData.xmlembedded resource in the netfx and the netcore projects. This PR merges these with a single file. More importantly though, this embedded resource is used only withinDbMetaDataFactory; it's deserialized usingDataSet.ReadXml, where it is eventually used inSqlConnection.GetSchema.DataSet.ReadXmlisn't trim-safe - it uses XML serialization in the background. I've replaced this with a simple parsing routine which runs against the embedded resource and adds the rows manually.The net result is smaller, faster and more efficient. Sizoscope confirms that this PR cuts the file size of a simple application by 3.8MB, from 20.4MB to 16.6MB. Benchmark results for this in isolation are:
Separately, I noticed that my earlier PR #3309 generated two warnings when publishing because it wasn't using a fully-qualified type name. I've adjusted this.
Issues
Relates to #1942.
Relates to #1261.
Follows up #3309.
Testing
All tests continue to pass.
There's a lot of validation of the structure of the XML in the embedded resource, and this is done with debug assertions. I've treated this as hardcoded at the point of build, so haven't used exceptions for this. I can change this if needed.