0

I am developing a .net core console application where the application interact with SQL server for Linux,located locally, using Entity Framework Core.

When I run the application, I get the error shown below.

Process terminated. Couldn't find a valid ICU package installed on the system. Set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support.

Then I added the environment the following export

export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=true
Unhandled exception. System.AggregateException: One or more errors occurred. (Globalization Invariant Mode is not supported.)
 ---> System.NotSupportedException: Globalization Invariant Mode is not supported.
   at Microsoft.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at Microsoft.Data.SqlClient.SqlConnection.OpenAsync(CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnectionAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnectionAsync(Boolean errorsExpected, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenAsync(CancellationToken cancellationToken, Boolean errorsExpected)
   at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func`4 operation, Func`4 verifySucceeded, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable`1.AsyncEnumerator.MoveNextAsync()
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleAsync[TSource](IAsyncEnumerable`1 asyncEnumerable, CancellationToken cancellationToken)
   at advance_generics.part.one.Program.CountEmployees(IRepository`1 employeeRepo) in /home/bhaskar/C_Sharp_basics/advance_generics/Program.cs:line 24
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at advance_generics.part.one.Program.Main(String[] args) in /home/bhaskar/C_Sharp_basics/advance_generics/Program.cs:line 15

Can any body help me on this?

I did the following regarding ICU

 dpkg --status icu-devtools
Package: icu-devtools
Status: install ok installed
Priority: optional
Section: libdevel
Installed-Size: 678
Maintainer: Ubuntu Developers <[email protected]>
Architecture: amd64
Multi-Arch: foreign
Source: icu
Version: 66.1-2ubuntu2
Replaces: icu-tools (<< 66.1-1~), libicu-dev (<< 66.1-2ubuntu2)
Depends: libc6 (>= 2.14), libgcc-s1 (>= 3.0), libicu66 (>= 66.1-1~), libstdc++6 (>= 5.2)
Breaks: icu-tools (<< 66.1-1~), libicu-dev (<< 66.1-2ubuntu2)
Description: Development utilities for International Components for Unicode
 ICU is a C++ and C library that provides robust and full-featured
 Unicode and locale support. This package contains programs used to
 manipulate data files found in the ICU sources and is a dependency of
 libicu-dev.  End users would generally not need to install this package.
Homepage: http://www.icu-project.org
Original-Maintainer: Laszlo Boszormenyi (GCS) <[email protected]>

The problem is not encountered if I run in debug or Run without debug mode I don't get the error

1
  • i get the error when i use dotnet run Commented May 9, 2020 at 18:29

1 Answer 1

1

Based on the icu package version 66.1-2ubuntu2, I think you are running Ubuntu 20.04.

If that's true, this an incompatibility between .NET Core and Ubuntu 20.04: https://github.com/dotnet/core/issues/4360.

Really, this is a mistake by the .NET Core developers. There's not much you can do on your end to fix this. But you can apply some workarounds to avoid the issue.

The most common one seems to be the following. To emphasise, this is a workaround. It's probably okay, temporarily for a development environment. This is a not a good idea for a production environment.

sudo apt-add-repository 'deb http://archive.ubuntu.com/ubuntu/ eoan main restricted'
sudo apt-get update
sudo apt-get install libicu63

However, in my opinion, the better option is to stick to a lower version of Ubuntu, like 19.10, instead of using 20.04 that .NET Core is not compatible with.

Sign up to request clarification or add additional context in comments.

5 Comments

Yes I am using Ubuntu 20,04.
Yes I am using Ubuntu 20,04. I am already using dotnet --version =>3.1.201.Talking of your work-round:sudo apt-add-repository 'deb archive.ubuntu.com/ubuntu eoan main restricted' what is the impact
Sorry, right. You need to install libicu63, in that case. Fixed in the answer. Adding the eoan repo basically gets you packages from 19.10. Which is not a great idea because mixing the packages from two versions is generally not tested/supported and may lead to all sorts of other issues.
Then why debugging the code gives me the same error?
Correcting my comment Then why debugging the code doesn't give me the same error?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.