Skip to content

value cannot be null. (Parameter 'jSObjectReference') #3692

Answered by ArgoZhang
eramosr16 asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for contacting us. according to the stack trace, it should be jsRuntime.InvokeAsync that reports an error, so I do not recommend fixing this problem.

public static async Task<JSModule> LoadModule(this IJSRuntime jsRuntime, string fileName, string? version = null)
{
    if (!string.IsNullOrEmpty(version))
    {
        fileName = $"{fileName}?v={version}";
    }
    var jSObjectReference = await jsRuntime.InvokeAsync<IJSObjectReference>(identifier: "import", fileName);
    return new JSModule(jSObjectReference);
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ArgoZhang
Comment options

Answer selected by eramosr16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
bug Something isn't working
2 participants
Converted from issue

This discussion was converted from issue #3691 on June 20, 2024 04:02.