injecting IJSRuntime by constructor result in different/not useable instance
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
When using constructor DI for blazor components with IJSRuntime - you will get a different / broken instance. This instance will always throw an exception on any InvokeAsync call
if you use property DI it works as inteded
Reproduction Steps
- create blazor component with IJSRuntime injected by constructor
- call InvokeAsync inside OnAfterRenderAsync
Expected behavior
No response
Actual behavior
exception thrown
at Microsoft.AspNetCore.Components.Server.Circuits.RemoteJSRuntime.BeginInvokeJS(Int64 asyncHandle, String identifier, String argsJson, JSCallResultType resultType, Int64 targetInstanceId) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, CancellationToken cancellationToken, Object[] args) at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args)
Regression?
No response
Known Workarounds
dont use constructor DI for blazor components
Version
6.0.1
User Interface
Blazor Server
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response