Task 42966: Identify and fix any non-localized exception strings#4022
Task 42966: Identify and fix any non-localized exception strings#4022paulmedynski merged 1 commit intomainfrom
Conversation
- Added base (English) localizations for all non-localized exception messages.
There was a problem hiding this comment.
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.resxand corresponding auto-generated properties inStrings.Designer.cs, replacing inline exception messages withStringsHelper.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
ArgumentNullExceptionconstructor usage, and changed bareExceptionthrows toInvalidOperationException. - Added test harness stubs (
Packet.TestHarness.csand updates toTdsParserStateObject.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.
...t.Data.SqlClient/src/Microsoft/Data/SqlClient/Reliability/SqlConfigurableRetryLogicLoader.cs
Show resolved
Hide resolved
src/Microsoft.Data.SqlClient/tests/FunctionalTests/Packet.TestHarness.cs
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
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
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:
|
Description
Added base (English) localizations for all non-localized exception messages.
Testing
The usual PR/CI runs will suffice.