Closed jbrown29 closed 1 year ago
I just created identical .Net 6, .Net 7, and .Net 8 "Blazor WebAssembly Standalone Apps" to test HTTPClient in WebWorkers. In .Net 6 I got the same error you did. It worked correctly in .Net 7 and .Net 8.
I know fetch works in WebWorkers so I'm not sure what is causing the failure at the moment.
Thank you for letting me know about this issue. I will post back after I have a chance to investigate further.
I found the cause of the issue and fixed it. I have uploaded an updated Nuget package, version 2.2.17.
Thank you very much for finding this issue and reporting it.
You're awesome. Thank you so much!
Is System.Net.Http.HttpClient supported in this webworker?
I'm using .net 6.0 and am getting this exception when calling SendAsync from HttpClient.
SyncDataException: Data Sync Error VM8:3 ---> System.Net.Http.HttpRequestException: TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation VM8:3 ---> System.Runtime.InteropServices.JavaScript.JSException: TypeError: Failed to execute 'fetch' on 'WorkerGlobalScope': Illegal invocation VM8:3 at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) VM8:3 --- End of inner exception stack trace --- VM8:3 at System.Net.Http.BrowserHttpHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) VM8:3 at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)