-
Notifications
You must be signed in to change notification settings - Fork 286
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
dotnet ef database update fails with default InvariantGlobalization mode #2206
Comments
Please share you csproj file. This looks like a SqlClient issue. |
@ErikEJ this is the project file: <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-rc.2.23480.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.0-rc.2.23480.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-rc.2.23480.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-rc.2.23480.1" />
</ItemGroup>
</Project> Turning off InvariantGlobalization, everything works as expected. With the default value |
Duplicate of #1913 |
@christiannagel Try using 5.2 preview of Microsoft.Data.SqlClient |
@ErikEJ I added Microsoft.Data.SqlClient, version 5.2.0-preview3.23201.1 to the project. Running
The exception message is now reversed, but still not a good experience with the new project templates. |
I've now also seen a related discussion to only use invariant globalization in native AOT with ASP.NET Core projects, but with .NET 8 RC 2 it's still enabled by default - with non-AOT projects: |
This is by design. 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. The only solution for now would be removing below tag from your csproj. You can see more about this on issue #220 <InvariantGlobalization>true</InvariantGlobalization> Or set it to false. |
Closing the issue as this is by design. Any progress on this issue in future could be tracked at #220. If you can investigate the issue and track all related areas in the code, feel free to open a Pull Request and we will review that. |
With .NET 8, web projects are now created with the
InvariantGlobalization
mode turned on with web applications.Using
dotnet ef database update
fails with this exception:Turning off InvariantGlobalization, everything works as expected.
With the new default project configuration, this shouldn't be the experience. Also, is there a better way than to turn InvariantGlobalization off?
Provider and version information
EF Core version:
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8 RC 2
Operating system: Windows 11
IDE: Visual Studio 2022 17.8 Preview 6
The text was updated successfully, but these errors were encountered: