Skip to content

Introduce .UseInvariantCulture() extension methods for host and web builders#1791

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/add-useinvariantculture-extension
Draft

Introduce .UseInvariantCulture() extension methods for host and web builders#1791
Copilot wants to merge 4 commits intomainfrom
copilot/add-useinvariantculture-extension

Conversation

Copy link
Contributor

Copilot AI commented Feb 17, 2026

Added

  • Extension method IHostBuilder.UseInvariantCulture() in Arc.Core configures default thread cultures to InvariantCulture
  • Extension method WebApplicationBuilder.UseInvariantCulture() in Arc configures thread cultures and request localization to InvariantCulture only
  • Extension method WebApplication.UseInvariantCulture() in Arc applies invariant culture middleware to the request pipeline

Usage:

// ASP.NET Core
var builder = WebApplication.CreateBuilder(args);
builder.UseInvariantCulture();
builder.AddCratisArc();

var app = builder.Build();
app.UseInvariantCulture();
app.UseCratisArc();

// Generic Host
var builder = Host.CreateDefaultBuilder(args);
builder.UseInvariantCulture();
builder.AddCratisArcCore();

Implementation approach:

  • Sets CultureInfo.DefaultThreadCurrentCulture and CultureInfo.DefaultThreadCurrentUICulture to InvariantCulture ensuring all threads use invariant culture
  • Configures RequestLocalizationOptions with only InvariantCulture and clears all culture providers to prevent runtime culture changes
  • Aligns with existing codebase patterns that already use InvariantCulture for JSON and MongoDB serialization
Original prompt

This section details on the original issue you should resolve

<issue_title>Introduce a .UseInvariantCulture() extension method for host builder and Web builders</issue_title>
<issue_description>It should configure all places that needs to be configured for culture.
Research the best way to guarantee invariant culture at runtime.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits February 17, 2026 13:43
Co-authored-by: einari <134365+einari@users.noreply.github.com>
Co-authored-by: einari <134365+einari@users.noreply.github.com>
Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Introduce .UseInvariantCulture() extension method for builders Introduce .UseInvariantCulture() extension methods for host and web builders Feb 17, 2026
Copilot AI requested a review from einari February 17, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce a .UseInvariantCulture() extension method for host builder and Web builders

2 participants

Comments