Skip to content

Backport 5.1 | SqlDecimal Extract Data #3465

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: release/5.1
Choose a base branch
from

Conversation

benrr101
Copy link
Contributor

@benrr101 benrr101 commented Jul 9, 2025

Description

Due to legal reasons, we have to take a change to the SqlDecimal type workarounds in netfx.

Issues

N/A

Testing

This is a drop-in replacement for the existing method, CI should successfully verify.

@Copilot Copilot AI review requested due to automatic review settings July 9, 2025 17:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Backports a simplified SqlDecimalExtractData implementation for .NET Framework by replacing the reflection/serialization workaround with direct use of SqlDecimal.Data, and cleans up related code and usings.

  • Removes the old SqlDecimalHelper reflection-based logic and adds a lean method that uses the documented Data property.
  • Adds region/doc comments to mirror the NetCore WriteTdsValue API and cleans up unused using directives.
  • Adjusts formatting and links for other type workarounds (e.g., SqlMoney, SqlBinary, SqlGuid).
Comments suppressed due to low confidence (2)

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlTypes/SqlTypeWorkarounds.netfx.cs:144

  • [nitpick] The comment references m_data[1-4] as if it’s an indexed field array, but SqlDecimal uses separate m_data1m_data4 fields. It may be clearer to rephrase to avoid implying a non-existent array.
            // Note: Although it would be faster to use the m_data[1-4] member variables in

src/Microsoft.Data.SqlClient/netfx/src/Microsoft/Data/SqlTypes/SqlTypeWorkarounds.netfx.cs:137

  • This new SqlDecimalExtractData logic should be covered by unit tests to verify correct field extraction (e.g., for various scales, signs, and null values). Consider adding tests to prevent future regressions.
        internal static void SqlDecimalExtractData(

Copy link

codecov bot commented Jul 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.59%. Comparing base (6af24bc) to head (404f186).

Additional details and impacted files
@@               Coverage Diff               @@
##           release/5.1    #3465      +/-   ##
===============================================
- Coverage        71.80%   68.59%   -3.22%     
===============================================
  Files              293      293              
  Lines            61647    61586      -61     
===============================================
- Hits             44266    42244    -2022     
- Misses           17381    19342    +1961     
Flag Coverage Δ
addons 0.00% <ø> (-92.39%) ⬇️
netcore 69.92% <ø> (-5.95%) ⬇️
netfx 68.37% <100.00%> (-1.18%) ⬇️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant