core icon indicating copy to clipboard operation
core copied to clipboard

SqlConnection.Open throws an InvalidOperationException

Open wuxubiao opened this issue 8 years ago • 10 comments

SqlConnection throw an Exceoption by calling open Method

When I add this configuration to the project.csproj,whether the value is true or false

<ItemGroup>
    <RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
</ItemGroup>
SqlConnection throws an Exceoption by calling open Method
            var connection = new SqlConnection();
            connection.ConnectionString = "SomeConnectionString ";
            connection.Open();

InvalidOperationException: Internal connection fatal error.

System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, uint waitForMultipleObjectsTimeout, bool allowCreate, bool onlyOneCheckConnection, DbConnectionOptions userOptions, out DbConnectionInternal connection)

wuxubiao avatar Nov 21 '18 05:11 wuxubiao

@tarekgh any advice here? cc @keeratsingh @AfsanehR @David-Engel

karelz avatar Nov 26 '18 04:11 karelz

SQL team need to take a look to know why the connection is failed. the issue here is not clear to me why this is failed.

tarekgh avatar Nov 26 '18 16:11 tarekgh

@wuxubiao By the initial looks of the issue it seems quite similar to an existing issue #29147. As per the discussions it seems like SqlClient currently doesn't support running with the Globalization Invariant Mode. The workaround is to install the package icu-libs and set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

If the issue still exists could you kindly share the following:

  • Output of command dotnet --info.
  • Repro with the csproj file that is being used. (includes the SqlClient version)
  • Complete stack trace.

keeratsingh avatar Nov 26 '18 17:11 keeratsingh

@karelz Should this issue be moved to https://github.com/dotnet/corefx and tracked there instead ?

keeratsingh avatar Nov 26 '18 17:11 keeratsingh

Yes, either close it as dupe of existing CoreFX issue, or move it to CoreFX. Does it exist in CoreFX already?

karelz avatar Nov 26 '18 17:11 karelz

#29147 already exists in CoreFX, however before I move/mark issue(#2072) as duplicate, I need more information form the user. I will proceed accordingly once I have the required information.

keeratsingh avatar Nov 26 '18 17:11 keeratsingh

In such case it is up to you if you want to track it here and then dupe it/move it, or move it right away to clarify in CoreFX.

karelz avatar Nov 26 '18 17:11 karelz

@wuxubiao By the initial looks of the issue it seems quite similar to an existing issue #29147. As per the discussions it seems like SqlClient currently doesn't support running with the Globalization Invariant Mode. The workaround is to install the package icu-libs and set DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=false

If the issue still exists could you kindly share the following:

  • Output of command dotnet --info.
  • Repro with the csproj file that is being used. (includes the SqlClient version)
  • Complete stack trace.

install icu,it work

wuxubiao avatar Nov 27 '18 07:11 wuxubiao

Duplicate of https://github.com/dotnet/corefx/issues/29147

keeratsingh avatar Nov 27 '18 17:11 keeratsingh

@keeratsingh I updated your above message - this way GH recognizes it as duplicate - see https://github.com/dotnet/core/issues/2072#event-1990313873

karelz avatar Nov 27 '18 17:11 karelz