LoginForm: IStringLocalizer<LoginForm> injection is required in practice, breaks apps without AddLocalization() #35

Open
opened 2026-06-10 22:46:50 +00:00 by Grandiras · 0 comments
Owner

v0.4.0 release notes describe the new IStringLocalizer<LoginForm> support as optional ("when registered … default copy is resolved by parameter name"). In practice, rendering <LoginForm /> in an app that has not called services.AddLocalization() throws:

System.InvalidOperationException: Cannot provide a value for property 'Localizer' on type 'ATProtoNet.Blazor.Components.LoginForm'. There is no registered service of type 'Microsoft.Extensions.Localization.IStringLocalizer`1[ATProtoNet.Blazor.Components.LoginForm]'.

Hit while upgrading Updraft.Kanban from 0.3.0 → 0.4.0: the /login page 500s. Explicit ButtonText/HandlePlaceholder values don't avoid it — the failure is at property-injection time, before parameters apply.

Expected: the localizer should be optional as documented. Suggested fix: resolve via IServiceProvider.GetService<IStringLocalizer<LoginForm>>() or an optional injection.

Workaround for consumers: builder.Services.AddLocalization();

v0.4.0 release notes describe the new `IStringLocalizer<LoginForm>` support as optional ("when registered … default copy is resolved by parameter name"). In practice, rendering `<LoginForm />` in an app that has not called `services.AddLocalization()` throws: ``` System.InvalidOperationException: Cannot provide a value for property 'Localizer' on type 'ATProtoNet.Blazor.Components.LoginForm'. There is no registered service of type 'Microsoft.Extensions.Localization.IStringLocalizer`1[ATProtoNet.Blazor.Components.LoginForm]'. ``` Hit while upgrading Updraft.Kanban from 0.3.0 → 0.4.0: the /login page 500s. Explicit `ButtonText`/`HandlePlaceholder` values don't avoid it — the failure is at property-injection time, before parameters apply. Expected: the localizer should be optional as documented. Suggested fix: resolve via `IServiceProvider.GetService<IStringLocalizer<LoginForm>>()` or an optional injection. Workaround for consumers: `builder.Services.AddLocalization();`
Sign in to join this conversation.
No description provided.