"`ElementReference` is not assignable to parameter type 'object?[]?" error on `InvokeAsync` method

18 hours ago 2
ARTICLE AD BOX

I got error

Argument type 'Microsoft.AspNetCore.Components.ElementReference' is not assignable to parameter type 'object?[]?'

at line this.rootElement of

protected Microsoft.AspNetCore.Components.ElementReference rootElement; public async System.Threading.Tasks.ValueTask<IValidatableControl.RootElementOffsetCoordinates> getRootElementOffsetCoordinates() { return await this.javaScriptRuntime.InvokeAsync<RootElementOffsetCoordinates>( "getDOM_ElementOffsetCoordinates", this.rootElement ); }

where RootElementOffsetCoordinates is

record RootElementOffsetCoordinates { public required double Top { get; init; } public required double Left { get; init; } }

AFAIK basically the passing of Microsoft.AspNetCore.Components.ElementReference as the second parameter of InvokeAsync is fine. Am I doting something wrong?

Read Entire Article