Skip to content

Support Globalization Invariant Mode on alpine images #1249

Closed

Description

@ilya-git

Is your feature request related to a problem? Please describe.

Right now Globalization Invariant Mode is not supported by this new SQL client library on alpine images. I have used the latest System.Data.SqlClient before I switched to Microsoft.Data.SqlClient and there was no problems at all. It seems strange to me that the new library is not supporting what the older one never had troubles with.

Describe the solution you'd like

A clear and concise description of what you want to happen.

Describe alternatives you've considered

I am now using this code in the docker file that is a workaround, but I would rather remove it so that both built time and the sime of the image is smaller.

RUN apk add icu-libs
ENV DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

Additional context

It would be very nice for developers to not use time to figure out why things suddenly stopped working after updating from the old to the new library.

Here is the reference to the issue where the correct exception message has been introduced.

Activity

  1. Wraith2 commented on Sep 3, 2021

    @Wraith2
    Contributor

    I wrote up a blog post about this https://blog.wraithware.org/2020/05/23/SqlClient-and-Globalization-Invariant-mode.html
    The old System version shouldn't have worked in invariant mode and doing so could have caused your data to be returned incorrectly.

  2. ilya-git commented on Sep 3, 2021

    @ilya-git
    Author

    Maybe not, but it did work pretty fine in reality :) Anyway it would be nice to not think about this and have support in the sql library.

  3. Wraith2 commented on Sep 3, 2021

    @Wraith2
    Contributor

    But you do understand that there's an easy workaround right? So the current functionality protects your data integrity and allows you to use the additional functionality if you put the underlying OS in a state where it has the support needed for the feature.

  4. JRahnama commented on Sep 3, 2021

    @JRahnama
    Contributor

    @ilya-git Hi,

    This is by design.

    .NET Core 2.2 + EFCore 2.2.6 + Alpine works because you happen to be using compatible collations between the client and server. If they had been different, you could hit issue #81 So we added the specific exception message pointing users to the problem and solution. It would take a lot of time to identify the scenarios where the new Globalization Invariant Mode can be supported by SqlClient and target code changes specific to those scenarios. Note, it's not just at connection Open() that exceptions could occur so identifying everywhere the code would have to essentially "defend" against Globalization Invariant Mode could be very extensive.

    I close the issue as it is by design. Feel free to reopen if you have more to add. Also note, as an open source repository we welcome any contribution. If you can find out the possible scenarios make a PR and we will review it.

  5. ilya-git commented on Sep 3, 2021

    @ilya-git
    Author

    I did not realize it's a complicated feature to add. What you say makes sense. It's just it's not that very obvious when one sees this error what should be done. Googling gives some issues in Github, so I figured what to do, but it was not straightforward. It's also possible that very many backend API's do not need globalization. Additionally maybe it's a good idea to have a separate docker build with alpine that supports this out of the box, since many use SQL client library I would assume? Or perhaps the plan to use ubuntu in these cases...

    Anyway, thanks for the explanation!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions