Skip to content

Task 42966: Identify and fix any non-localized exception strings#4022

Merged
paulmedynski merged 1 commit intomainfrom
dev/paul/localizations
Mar 9, 2026
Merged

Task 42966: Identify and fix any non-localized exception strings#4022
paulmedynski merged 1 commit intomainfrom
dev/paul/localizations

Conversation

@paulmedynski
Copy link
Contributor

Description

Added base (English) localizations for all non-localized exception messages.

Testing

The usual PR/CI runs will suffice.

- Added base (English) localizations for all non-localized exception messages.
@paulmedynski paulmedynski added this to the 7.0.0 milestone Mar 9, 2026
@paulmedynski paulmedynski requested a review from a team as a code owner March 9, 2026 15:49
Copilot AI review requested due to automatic review settings March 9, 2026 15:49
@paulmedynski paulmedynski added the Area\Documentation Use this for issues that requires changes in public documentations/samples. label Mar 9, 2026
@github-project-automation github-project-automation bot moved this to To triage in SqlClient Board Mar 9, 2026
Copy link
Contributor

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

This PR localizes hardcoded exception message strings across several source files by moving them into the Strings.resx resource file, enabling future localization. Along the way, it fixes several typos in the original messages and corrects a misused ArgumentNullException constructor.

Changes:

  • Added 16 new resource strings to Strings.resx and corresponding auto-generated properties in Strings.Designer.cs, replacing inline exception messages with StringsHelper.GetString(...) calls across multiple source files.
  • Fixed typos and minor grammar issues in the original messages (e.g., "paramter" → "parameter", "non=null" → "non-null", "transit" → "transition"), corrected ArgumentNullException constructor usage, and changed bare Exception throws to InvalidOperationException.
  • Added test harness stubs (Packet.TestHarness.cs and updates to TdsParserStateObject.TestHarness.cs) to support the new resource references when source files are compiled directly into the functional test project.

Reviewed changes

Copilot reviewed 12 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Microsoft.Data.SqlClient/src/Resources/Strings.resx Added 16 new resource string entries for previously hardcoded exception messages; whitespace cleanup in file header
src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs Auto-generated properties matching the new .resx entries
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/ChannelDbConnectionPool.cs Replaced hardcoded string with resource lookup; changed Exception to InvalidOperationException; removed TODO comment
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ConnectionPool/ConnectionPoolSlots.cs Replaced hardcoded string with resource lookup
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Packet.cs Replaced hardcoded string with resource lookup
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.cs Replaced 3 hardcoded strings (in #if DEBUG blocks) with resource lookups
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/TdsParserStateObject.Multiplexer.cs Replaced 2 hardcoded strings with resource lookups; fixed "non=null" typo
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/ActiveDirectoryAuthenticationTimeoutRetryHelper.cs Replaced 4 hardcoded strings with resource lookups; fixed "transit" → "transition"; whitespace cleanup
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs Replaced 8 hardcoded strings with resource lookups; fixed ArgumentNullException constructor; changed Exception to InvalidOperationException; fixed "paramter" typo
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlConnection.cs Replaced hardcoded string with resource lookup; uses FullName instead of ToString() for type
src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/Utilities/ObjectPool.cs Replaced hardcoded string with resource lookup
src/Microsoft.Data.SqlClient/tests/FunctionalTests/TdsParserStateObject.TestHarness.cs Added 2 new string stubs for multiplexer resource references
src/Microsoft.Data.SqlClient/tests/FunctionalTests/Packet.TestHarness.cs New file: namespace-level stubs for StringsHelper and Strings needed when Packet.cs is compiled into the test project
Files not reviewed (1)
  • src/Microsoft.Data.SqlClient/src/Resources/Strings.Designer.cs: Language not supported

You can also share your feedback on Copilot code review. Take the survey.

@paulmedynski paulmedynski moved this from To triage to In review in SqlClient Board Mar 9, 2026
@codecov
Copy link

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 26.08696% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.57%. Comparing base (569ada7) to head (5bc9110).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...ActiveDirectoryAuthenticationTimeoutRetryHelper.cs 0.00% 4 Missing ⚠️
...ent/Reliability/SqlConfigurableRetryLogicLoader.cs 55.55% 4 Missing ⚠️
...c/Microsoft/Data/SqlClient/TdsParserStateObject.cs 0.00% 3 Missing ⚠️
...Data/SqlClient/TdsParserStateObject.Multiplexer.cs 0.00% 2 Missing ⚠️
...qlClient/ConnectionPool/ChannelDbConnectionPool.cs 0.00% 1 Missing ⚠️
...ta/SqlClient/ConnectionPool/ConnectionPoolSlots.cs 0.00% 1 Missing ⚠️
...a.SqlClient/src/Microsoft/Data/SqlClient/Packet.cs 0.00% 1 Missing ⚠️
...ient/src/Microsoft/Data/SqlClient/SqlConnection.cs 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (569ada7) and HEAD (5bc9110). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (569ada7) HEAD (5bc9110)
CI-SqlClient 1 0
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4022      +/-   ##
==========================================
- Coverage   72.36%   64.57%   -7.79%     
==========================================
  Files         287      282       -5     
  Lines       43149    66071   +22922     
==========================================
+ Hits        31223    42667   +11444     
- Misses      11926    23404   +11478     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 64.57% <26.08%> (?)

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.

@paulmedynski paulmedynski merged commit ae9294b into main Mar 9, 2026
300 checks passed
@paulmedynski paulmedynski deleted the dev/paul/localizations branch March 9, 2026 19:17
@github-project-automation github-project-automation bot moved this from In review to Done in SqlClient Board Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area\Documentation Use this for issues that requires changes in public documentations/samples.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants