Tewr / BlazorWorker

Library for creating DotNet Web Worker threads/multithreading in Client side Blazor
MIT License
394 stars 36 forks source link

WASM-WORKER: BlazorWorker.WorkerCore.SimpleInstanceService.SimpleInstanceService: 'WebAssembly.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is requesting missing assembly 'Microsoft.AspNetCore.Components, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'). See https://github.com/Tewr/BlazorWorker#setup-dependencies for common solutions to this problem. #112

Closed ftru closed 5 months ago

ftru commented 5 months ago

I had develop blazor Webassembly application with .NET 6.0 . I had used the BlazorWorker for background task

var worker = await workerFactory.CreateAsync();

// Create service reference. For most scenarios, it's safe (and best) to keep this 
// reference around somewhere to avoid the startup cost.
var service = await worker.CreateBackgroundServiceAsync<Ordering>();

// Reference that live outside of the current scope should not be passed into the expression.
// To circumvent this, create a scope-local variable like this, and pass the local variable.
var result = await service.RunAsync(s => s.orderonholdsync("This is holdorder"));

}

I got that issue when execute this line var service = await worker.CreateBackgroundServiceAsync();

ftru commented 5 months ago

Microsoft.AspNetCore.Components this assembly have but issue occured

Tewr commented 5 months ago

Are you using v3.2.2? Indeed, the link in the exception is no longer working, as it is obsolete since v4.0.0

For 3.2.2, you need to follow the guidance here, and manually declare all dependencies

https://github.com/Tewr/BlazorWorker/tree/v3.2.2#setup-dependencies

If possible, I would recommend to upgrade to .net7 or .net8 to be able to use the latest version of this library.

Let me know if that helps you.