Open ardalis opened 10 months ago
I just created a new webapi project
I believe we only set InvariantGlobalization=true when you use the AoT-enabled Web API template. Can you verify if this is the case?
Assuming so, @eerhardt do we document the fact that this is set for AoT templates anywhere?
I believe we only set InvariantGlobalization=true when you use the AoT-enabled Web API template. Can you verify if this is the case?
There was a time (8.0.0 - 8.0.1) where we were setting it in the webapi template regardless if you used AOT or not. This was fixed in 8.0.2 with https://github.com/dotnet/aspnetcore/pull/52461. If you are using the latest patches, this is now fixed.
do we document the fact that this is set for AoT templates anywhere?
I'm not sure and I don't know where that would be documented (maybe it should be on https://learn.microsoft.com/aspnet/core/fundamentals/native-aot?). This is basically a performance optimization. Since you are using AOT, we figured it makes sense to default to this mode. See https://github.com/dotnet/aspnetcore/issues/47029.
I wasn't using an AOT template (must've been 8.0.0-8.0.1). Sounds like this can probably be closed if it's resolved in the template (though I'd make sure the docs for AOT templates are clear about this).
I'd like to share some experience here. I just created a new webapi project and then added EF Core support. I didn't pay super close attention to the template's csproj file, as I assumed it would basically work as it has in the past. If I noticed the existence of this property it didn't jump out at me:
So, it came as a surprise to me when I had finished adding EF Core DbContext support and was using the CLI to create migrations, as I've done 100s of times in the past, and when I tried to update my localdb SQL Server I got this:
Now, knowing I'd just created this project I was 100% sure I hadn't specified "en-us" anywhere in my code to configure and set up my DbContext. There's nothing in this that suggests I should look at my Web API project. The stack trace only includes EF Core types. Fortunately, my search led me to the setting and issues like this one:
https://github.com/dotnet/SqlClient/issues/2239
(and probably this issue's existence will help others as well)
Proposal
Improve the error message shown above to suggest checking the application's project file to see if
<InvariantCulture>
has been set and, if so, to remove that setting (or set it to false).Alternately, figure out a way to make local SQLServer development work with invariant culture.