Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Globalization Invariant Mode on alpine images #1249

Closed
ilya-git opened this issue Sep 3, 2021 · 5 comments
Closed

Support Globalization Invariant Mode on alpine images #1249

ilya-git opened this issue Sep 3, 2021 · 5 comments

Comments

@ilya-git
Copy link

ilya-git commented Sep 3, 2021

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.

@Wraith2
Copy link
Contributor

Wraith2 commented Sep 3, 2021

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.

@ilya-git
Copy link
Author

ilya-git commented Sep 3, 2021

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.

@Wraith2
Copy link
Contributor

Wraith2 commented Sep 3, 2021

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.

@JRahnama
Copy link
Contributor

JRahnama commented Sep 3, 2021

@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.

@JRahnama JRahnama closed this as completed Sep 3, 2021
@ilya-git
Copy link
Author

ilya-git commented Sep 3, 2021

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants