Skip to content

Conversation

@salihozkara
Copy link
Contributor

@salihozkara salihozkara commented Dec 30, 2025

Fixes #37432

Summary of the changes

  • Fixed SQLite decimal collation to use invariant culture for parsing decimal values
  • Ensured correct decimal comparison in SQLite regardless of the application's current culture

Details

  • Updated SqliteConnection.CreateCollation to use CultureInfo.InvariantCulture when parsing decimal strings
  • Added test coverage for decimal ordering with Turkish culture (tr-TR) to verify the fix
  • The issue occurred when the application culture used a different decimal separator (e.g., comma in Turkish), causing incorrect sorting of decimal values

Fixes

This addresses the issue where SQLite decimal comparison would fail when the application was running under a culture that uses a different decimal separator (e.g., Turkish using comma instead of period).

dotnet-maestro bot and others added 3 commits December 22, 2025 19:59
[release/10.0] Source code updates from dotnet/dotnet
[release/10.0] Source code updates from dotnet/dotnet
Updated decimal parsing in EF_DECIMAL collation to use CultureInfo.InvariantCulture for consistent ordering across cultures. Added a test to verify correct ordering of decimal values under Turkish culture.
Copilot AI review requested due to automatic review settings December 30, 2025 16:55
@salihozkara salihozkara requested a review from a team as a code owner December 30, 2025 16:55
Eliminated the unnecessary 'using System.Globalization;' directive from BuiltInDataTypesSqliteTest.cs to clean up the code.
Copy link

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 fixes a culture-specific bug in SQLite decimal comparison where using Turkish culture (or any culture with a different decimal separator) would cause incorrect sorting of decimal values.

  • Updated the EF_DECIMAL collation to parse decimal strings using CultureInfo.InvariantCulture
  • Added comprehensive test coverage for decimal ordering under Turkish culture (tr-TR)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/EFCore.Sqlite.Core/Storage/Internal/SqliteRelationalConnection.cs Updated the EF_DECIMAL collation to use InvariantCulture when parsing decimal strings, fixing culture-sensitive comparison issues
test/EFCore.Sqlite.FunctionalTests/BuiltInDataTypesSqliteTest.cs Added test with Turkish culture to verify decimal ordering works correctly regardless of application culture

Adjusted the TestDecimal values for test entities in Can_query_OrderBy_decimal_with_Turkish_culture to ensure correct ordering and test coverage.
@AndriySvyryd AndriySvyryd changed the base branch from release/10.0 to main December 30, 2025 20:08
@AndriySvyryd AndriySvyryd self-assigned this Dec 30, 2025
Copilot AI review requested due to automatic review settings December 31, 2025 01:37
Copy link

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@roji
Copy link
Member

roji commented Dec 31, 2025

Note: I have not opened an issue for this change, as it is a straightforward bug fix with clear scope and implementation.

Can you please open an issue? We try to always have an issue - especially when there's a bug - so that it's clear which release contains what, and when a bug was fixed, etc.

@salihozkara
Copy link
Contributor Author

Note: I have not opened an issue for this change, as it is a straightforward bug fix with clear scope and implementation.

Can you please open an issue? We try to always have an issue - especially when there's a bug - so that it's clear which release contains what, and when a bug was fixed, etc.

#37432

Copy link
Member

@roji roji left a comment

Choose a reason for hiding this comment

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

Thanks for submitting a fix! See below for some comments.


<PropertyGroup Label="Version settings">
<VersionPrefix>10.0.2</VersionPrefix>
<VersionPrefix>10.0.3</VersionPrefix>
Copy link
Member

Choose a reason for hiding this comment

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

Please revert, we handle version bumps separately.

Copy link
Member

Choose a reason for hiding this comment

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

This was caused by the base branch change. Please rebase on main

}

[ConditionalFact, UseCulture("tr-TR")]
public virtual void Can_query_OrderBy_decimal_with_Turkish_culture()
Copy link
Member

Choose a reason for hiding this comment

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

Can you please reduce this test to the bare minimum, removing all the unneeded stuff? Check out the minimal repro posted here.

…tion.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings January 2, 2026 06:44
Copy link

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

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@AndriySvyryd AndriySvyryd assigned roji and unassigned AndriySvyryd Jan 2, 2026
@salihozkara
Copy link
Contributor Author

#37443

@salihozkara salihozkara closed this Jan 3, 2026
@roji
Copy link
Member

roji commented Jan 3, 2026

@salihozkara there's generally no need to open a new PR, you can always push-force a branch into the PR, replacing its contents. Please avoid doing that, as review history is more difficult to track etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQLite decimal collation fails under non-invariant cultures (e.g. tr-TR)

3 participants