Skip to content

Create GraphQLHttpWebSocket throw NotSupportedException in WASM #253

Closed
@albiberto

Description

@albiberto

I tryed to use GraphQLClient in Blazor WASM project.
During client instating was throw an exception.
By reading the code I see this problem in System.Reactive.Concurrency.EventLoopScheduler.
The problem is the ThreadFactory in the library becouse it try to create a new thread.

This is the stack trace:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: Cannot start threads on this runtime.
System.NotSupportedException: Cannot start threads on this runtime.
at (wrapper managed-to-native) System.Threading.Thread.Thread_internal(System.Threading.Thread,System.MulticastDelegate)
at System.Threading.Thread.StartInternal (System.Object principal, System.Threading.StackCrawlMark& stackMark) <0x31c6738 + 0x00008> in :0
at System.Threading.Thread.Start (System.Threading.StackCrawlMark& stackMark) <0x31c6630 + 0x0004c> in :0
at System.Threading.Thread.Start () <0x31c6570 + 0x0000e> in :0
at System.Reactive.Concurrency.EventLoopScheduler.EnsureThread () <0x31c5178 + 0x00036> in :0
at System.Reactive.Concurrency.EventLoopScheduler.Schedule[TState] (TState state, System.TimeSpan dueTime, System.Func3[T1,T2,TResult] action) <0x31bad40 + 0x0014e> in <filename unknown>:0 at System.Reactive.Concurrency.LocalScheduler.Schedule[TState] (TState state, System.Func3[T1,T2,TResult] action) <0x31b4ed8 + 0x0002e> in :0
at System.Reactive.Concurrency.Scheduler.Schedule (System.Reactive.Concurrency.IScheduler scheduler, System.Action action) <0x31b4c98 + 0x00060> in :0
at GraphQL.Client.Http.Websocket.GraphQLHttpWebSocket..ctor (System.Uri webSocketUri, GraphQL.Client.Http.GraphQLHttpClient client) <0x30b07d8 + 0x0013c> in :0
at GraphQL.Client.Http.GraphQLHttpClient..ctor (GraphQL.Client.Http.GraphQLHttpClientOptions options, GraphQL.Client.Abstractions.Websocket.IGraphQLWebsocketJsonSerializer serializer, System.Net.Http.HttpClient httpClient) <0x3062218 + 0x00140> in :0
at GraphQL.Client.Http.GraphQLHttpClient..ctor (GraphQL.Client.Http.GraphQLHttpClientOptions options, GraphQL.Client.Abstractions.Websocket.IGraphQLWebsocketJsonSerializer serializer) <0x3053fd8 + 0x0001e> in :0
at GraphQL.Client.Http.GraphQLHttpClient..ctor (System.Action`1[T] configure, GraphQL.Client.Abstractions.Websocket.IGraphQLWebsocketJsonSerializer serializer) <0x303e600 + 0x00010> in :0
at GraphQL.Client.Http.GraphQLHttpClient..ctor (System.Uri endPoint, GraphQL.Client.Abstractions.Websocket.IGraphQLWebsocketJsonSerializer serializer) <0x303e420 + 0x00030> in :0
at GraphQL.Client.Http.GraphQLHttpClient..ctor (System.String endPoint, GraphQL.Client.Abstractions.Websocket.IGraphQLWebsocketJsonSerializer serializer) <0x303e088 + 0x00012> in :0
at Angy.BackEndClient.Pages.IndexComponent.OnInitializedAsync () <0x3024408 + 0x00034> in :0
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x2f3ba28 + 0x00154> in :0

To solve the problem could it be a good idea change the EventLoopScheduler whit a custom implementation, since it is hosted in third-party library?

Thanks Alberto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions