You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider error diagnostic when SqlClient used when invariant globalization enabled. #2043
Is your feature request related to a problem? Please describe.
In the ASP.NET repo we have updated our API, Worker, and gRPC templates to use invariant globalization. Initially we enabled invariant globalization for those project templates regardless of whether the publishing target was native AOT or not but received feedback that this created friction for SQL client users. As a result we are opting out of invariant globalization non-native-AOT usage.
For native AOT users (where invariant globalization is the default) we believe that there is an opportunity for the SQL client team to raise a diagnostic alert to let them know that they should disable invariant globalization if their project happens to have it enabled.
Describe the solution you'd like
A extend/create Roslyn analyzer which warns if the project in which SqlClient is invoked from has Invariant Globalization enabled that a diagnostic error is raised. This would shift detection of this issue left for the developer instead of crashing at runtime.
Describe alternatives you've considered
We considered disabling invariant globalization for AOT scenarios, but for API scenarios we believe invariant globalization is a better initial choice. Given this it doesn't really make sense for us to have an analyzer for AOT usage in the ASP.NET repo, epecially since SqlClient's lack of support for invariant globalization isn't an ASP.NET specific issue (we understand that there are good reasons for SqlClient to depend on globalization support).
Additional context
Here is the original PR where we enabled invariant globalization: dotnet/aspnetcore#47066
Here is a customer issue reporting the usability problem to us: dotnet/aspnetcore#48186
Here is out PR opting out of invariant globalization for non-AOT scenarios: dotnet/aspnetcore#48238
Reacted by Jarred McGoldrick, Mark Adamson, Austin Drenski, Frulfump, KLuuKer and Martin Costello
Will SqlClient ever support invariant globalization? The new AWS lambda runtime doesn't have icu, so needs invariant globalization and this then means SqlClient can't be used there, without jumping through some hoops to bundle it with the deployed app
Will SqlClient ever support invariant globalization? The new AWS lambda runtime doesn't have icu, so needs invariant globalization and this then means SqlClient can't be used there
Unlikely. It would take a lot of effort and testing to ensure every part of the code behaves correctly in globalization invariant mode when processing all different types of data. Currently, I don't see that rising in priority over other things any time soon.
This issue (the analyzer check), however, seems relatively easy. We are going to look into it and see what it would entail.
Will SqlClient ever support invariant globalization? The new AWS lambda runtime doesn't have icu, so needs invariant globalization and this then means SqlClient can't be used there
Unlikely. It would take a lot of effort and testing to ensure every part of the code behaves correctly in globalization invariant mode when processing all different types of data. Currently, I don't see that rising in priority over other things any time soon.
This issue (the analyzer check), however, seems relatively easy. We are going to look into it and see what it would entail.
Has anything changed in that regard now that almost two years have passed?
Potentially related: #3742 (open, "Revisit support for globalization invariant mode"); already cross-linked to #1913 (closed) in earlier comments
Regression
Not indicated
Analysis
This is a long-standing feature request asking for a Roslyn analyzer/diagnostic that warns developers when SqlClient is referenced in a project with Invariant Globalization enabled (particularly relevant for Native AOT publishing, where invariant globalization is the default). The maintainers previously acknowledged the request in 2023 as "relatively easy" to investigate but no analyzer has landed yet. A recent comment (Oct 2025) and the just-added /triage comment show continued community interest. Severity assessment: P2 — no functional regression or crash, but it's a recurring pain point for Native AOT/invariant-globalization users and has accumulated reactions/interest over multiple years.
Next Steps
Since this is a well-specified, low-complexity feature request (build-time analyzer, not runtime driver behavior) with prior maintainer buy-in, consider assigning to Copilot coding agent to scope and implement a Roslyn analyzer (e.g., under a new or existing analyzer project) that detects InvariantGlobalization=true (via RuntimeHostConfigurationOption/.runtimeconfig.json or MSBuild property) in consuming projects and emits a build warning/diagnostic when Microsoft.Data.SqlClient is referenced.
Review Revisit support for globalization invariant mode #3742 for any overlapping design discussion before starting implementation, since it covers the broader "support invariant globalization" topic that this analyzer would complement (detect-and-warn vs. full support).
Confirm current priority with maintainers given the multi-year age of the request and renewed community interest.
Note: This triage summary is auto-generated by an AI agent. The analysis and suggestions above have not been verified by a human maintainer. Please treat as preliminary guidance only.
Activity
JRahnama commentedon May 25, 2023
@mitchdenny thanks for the suggestion. We will discuss this internally and will update you later.
mungojam commentedon Dec 8, 2023
Will SqlClient ever support invariant globalization? The new AWS lambda runtime doesn't have icu, so needs invariant globalization and this then means SqlClient can't be used there, without jumping through some hoops to bundle it with the deployed app
David-Engel commentedon Dec 12, 2023
Unlikely. It would take a lot of effort and testing to ensure every part of the code behaves correctly in globalization invariant mode when processing all different types of data. Currently, I don't see that rising in priority over other things any time soon.
This issue (the analyzer check), however, seems relatively easy. We are going to look into it and see what it would entail.
H-Yeo commentedon Dec 28, 2023
Also relates to: this topic #1913
Frulfump commentedon Oct 15, 2025
Has anything changed in that regard now that almost two years have passed?
The diagnostic would still be really nice!
priyankatiwari08 commentedon Sep 17, 2026
/triage
github-actions commentedon Sep 17, 2026
🔍 Triage Summary (on-demand re-triage)
Area\EngineeringAnalysis
This is a long-standing feature request asking for a Roslyn analyzer/diagnostic that warns developers when SqlClient is referenced in a project with Invariant Globalization enabled (particularly relevant for Native AOT publishing, where invariant globalization is the default). The maintainers previously acknowledged the request in 2023 as "relatively easy" to investigate but no analyzer has landed yet. A recent comment (Oct 2025) and the just-added
/triagecomment show continued community interest. Severity assessment: P2 — no functional regression or crash, but it's a recurring pain point for Native AOT/invariant-globalization users and has accumulated reactions/interest over multiple years.Next Steps
InvariantGlobalization=true(viaRuntimeHostConfigurationOption/.runtimeconfig.jsonor MSBuild property) in consuming projects and emits a build warning/diagnostic whenMicrosoft.Data.SqlClientis referenced.