Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the error message when the SetAuthenticatedUserContext called too early #251

Open
pavel-zhur opened this issue Dec 4, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@pavel-zhur
Copy link

pavel-zhur commented Dec 4, 2023

If I call the SetAuthenticatedUserContext before the host.RunAsync(), apparently the IJsRuntime is not available for the IApplicationInsights service yet, and I'm getting this error in the console:

Error: One or more errors occurred. (Value cannot be null. (Parameter 'jsRuntime'))
    at Jn (marshal-to-js.ts:349:18)
    at Ul (marshal-to-js.ts:306:28)
    at do_icall (03bff762:0x1e5b2)
    at do_icall_wrapper (03bff762:0x19519)
    at mono_interp_exec_method (03bff762:0xb447)
    at interp_entry (03bff762:0x1c94a)
    at interp_entry_static_0 (03bff762:0x1d40e)
    at wasm_native_to_interp_System_Private_CoreLib_ThreadPool_BackgroundJobHandler (03bff762:0x2a542d)
    at mono_background_exec (03bff762:0x4eb7c)
    at e.<computed> (cwraps.ts:338:24)

Looking at this error, it is hard to guess that the workaround is to call the InitJSRuntime explicitly.
It would be nice if the error message was more meaningful and included a suggestion.

@IvanJosipovic IvanJosipovic added the enhancement New feature or request label Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants