So, the problem is, that error occurred even before WASM builder creation:

This is really just the template used from VisualStudio for Blazor server project.
@page "/counter"
@rendermode InteractiveAuto
@inject IDataSourceFactory dataSourceFactory
<PageTitle>Counter</PageTitle>
<h1>Counter</h1>
<p role="status">Current count: @currentCount</p>
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
@code {
private int currentCount = 0;
private void IncrementCount()
{
dataSourceFactory.Create<SharedData.DataSourceResultType1>(25, "AAAAAA");
currentCount++;
}
}
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using ServerTest.Client;
using SharedData;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.Services.AddSingleton<IDataSourceFactory, DataSourceFactory>();
await builder.Build().RunAsync();
Without injection in Razor page, WASM Build breakpoint is being hit. Once I add @inject, the page will crash even before WASM is built. And the worst of all, Blazor server DI service is being provided if defined on Blazor server. What?