Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

NativeAOT | Remove DataSet.ReadXml, correct type name#3369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mdaigle merged 2 commits intodotnet:mainfromedwardneal:feat/aot-2
May 23, 2025

Conversation

edwardneal
Copy link
Contributor

@edwardnealedwardneal commentedMay 20, 2025
edited
Loading

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 theMicrosoft.Data.SqlClient.SqlMetaData.xml embedded 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.ReadXml isn'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:

MethodMeanErrorStdDevRatioRatioSDGen0Gen1AllocatedAlloc Ratio
Before1,819.7 μs25.07 μs23.45 μs1.000.02187.500039.0625829.81 KB1.00
After738.9 μs3.25 μs2.71 μs0.410.0162.500019.5313307.74 KB0.37

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.

filipnavara reacted with thumbs up emoji
This removes a reference to the built-in XML deserialization, which is slower and isn't trim-safe
@edwardnealedwardneal requested a review froma team as acode ownerMay 20, 2025 23:08
Copy link
Contributor

@mdaiglemdaigle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A few questions to help with my understanding

Copy link
Contributor

@paulmedynskipaulmedynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Asking for some clarification on why we're reading this XML at runtime.

@paulmedynski
Copy link
Contributor

/azp run

@azure-pipelinesAzure Pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@codecovCodecov
Copy link

codecovbot commentedMay 22, 2025
edited
Loading

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.22%. Comparing base(832e8da) to head(21cad07).
Report is 5 commits behind head on main.

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
FlagCoverage Δ
addons?
netcore66.64% <100.00%> (-1.70%)⬇️
netfx60.84% <100.00%> (-5.54%)⬇️

Flags with carried forward coverage won't be shown.Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report?Share it here.

🚀 New features to boost your workflow:
  • ❄️Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mdaiglemdaigle added this to the6.1-preview2 milestoneMay 23, 2025
@mdaiglemdaigle merged commita1bfea8 intodotnet:mainMay 23, 2025
237 checks passed
@edwardnealedwardneal deleted the feat/aot-2 branchMay 23, 2025 16:36
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mdaiglemdaiglemdaigle approved these changes

@paulmedynskipaulmedynskipaulmedynski approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
6.1-preview2
Development

Successfully merging this pull request may close these issues.

3 participants
@edwardneal@paulmedynski@mdaigle

[8]ページ先頭

©2009-2025 Movatter.jp