Skip to content

Conversation

alexmg
Copy link
Contributor

@alexmg alexmg commented Feb 21, 2025

Motivation and Context (Why the change? What's the scenario?)

SQL Server memory cannot be configured when using the Docker image because it depends on ICU which is not installed in the dotnet/aspnet:alpine image. This results in a System.NotSupportedException being thrown at runtime when SqlConnection attempts to open a connection.

System.NotSupportedException: Globalization Invariant Mode is not supported.
    at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry, SqlConnectionOverrides overrides)
    at Microsoft.Data.SqlClient.SqlConnection.InternalOpenAsync(CancellationToken cancellationToken)

High level description (Approach, Design)

Update the Dockerfile to install icu-libs and set the DOTNET_SYSTEM_GLOBALIZATION_INVARIANT environment variable as outlined in the Enabling (or disabling) globalization functionality document.

This problem is discussed extensively in dotnet/SqlClient#220.

Building the Docker image was also failing in Docker Desktop on Windows because of the separator used in the chown command. This has been changed from . to : which should provide greater compatibility.

https://www.gnu.org/software/coreutils/manual/html_node/chown-invocation.html#chown-invocation

Some older scripts may still use . in place of the : separator. POSIX 1003.1-2001 (see Standards conformance) does not require support for that, but for backward compatibility GNU chown supports . so long as no ambiguity results, although it issues a warning and support may be removed in future versions. New scripts should avoid the use of . because it is not portable, and because it has undesirable results if the entire owner.group happens to identify a user whose name contains ..

@alexmg alexmg requested a review from dluc as a code owner February 21, 2025 05:00
@dluc dluc merged commit 264c752 into microsoft:main Feb 21, 2025
2 checks passed
@dluc
Copy link
Collaborator

dluc commented Feb 21, 2025

Note: the resulting img is ~7MB bigger.

@alexmg alexmg deleted the sql-server-icu-fix branch February 24, 2025 02:02
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.

2 participants