insertBefore and appendChild in font awesome kit (version 5.15.4) causing csp issue only in Firefox Asp.Net Core

20 min read 05-10-2024
insertBefore and appendChild in font awesome kit (version 5.15.4) causing csp issue only in Firefox Asp.Net Core


Font Awesome 5.15.4 and CSP Issues in Firefox: A Deep Dive

Problem: While using Font Awesome 5.15.4 with insertBefore and appendChild methods within an ASP.NET Core application, you might encounter a Content Security Policy (CSP) violation in Firefox. This issue prevents certain icons from loading, impacting the user experience.

Rephrasing: Imagine you're using a popular library like Font Awesome to add icons to your website. Everything works smoothly on Chrome and other browsers, but Firefox throws an error, saying it can't load the icons. This happens because of a clash between the browser's security policy and how Font Awesome is being used.

Scenario and Code Example:

Let's assume we're using a simple ASP.NET Core Razor page with Font Awesome:

@page "/"
@using Microsoft.AspNetCore.Components.Web

<h1>Welcome to our site!</h1>

<div>
  <span class="fas fa-home"></span>
</div>

<script>
    //  This script uses insertBefore and appendChild to add icons dynamically
    window.onload = function () {
        const span = document.createElement("span");
        span.classList.add("fas", "fa-search");

        // Inserting the icon before another element
        const welcomeDiv = document.querySelector("div");
        welcomeDiv.insertBefore(span, welcomeDiv.firstChild); 

        // Appending the icon to another element
        const homeIcon = document.querySelector("span.fa-home");
        homeIcon.appendChild(span); 
    }
</script>

In this example, we dynamically add a search icon to the page, first before the 'Welcome' text and then append it to the home icon. This code works fine in most browsers, but Firefox throws a CSP violation error.

Why Firefox Throws the Error:

  • Strict CSP: Firefox has a very strict Content Security Policy (CSP) implementation, which limits how resources can be loaded. In this case, the default CSP settings in ASP.NET Core likely prevent insertBefore and appendChild from directly inserting elements into the DOM.
  • Inline Scripts: The use of window.onload and the JavaScript code within the <script> tag are considered "inline scripts." Strict CSP often prohibits inline scripting, considering it a security risk.

Solutions:

  1. CSP Configuration:

    • Add unsafe-inline: The quickest fix is to relax the CSP by allowing inline scripts. Add the following line to your Startup.cs or .ConfigureServices() method:

      builder.Services.AddAntiforgery(o => o.HeaderName = "X-CSRF-TOKEN");
      builder.Services.AddRazorPages().AddRazorRuntimeCompilation();
      builder.Services.AddSingleton<IConfiguration>(config);
      builder.Services.AddSingleton<IServerSideBlazorClientLogger>(logger);
      builder.Services.AddSingleton<IJSRuntime, BrowserJSRuntime>();
      builder.Services.AddSingleton<IJSRuntime>(serviceProvider => new BrowserJSRuntime(serviceProvider.GetRequiredService<IJSRuntime>()));
      builder.Services.AddSingleton<IClientObjectPool>(serviceProvider => new ClientObjectPool());
      builder.Services.AddSingleton<IHttpClientFactory>(serviceProvider => new HttpClientFactory());
      builder.Services.AddSingleton<IServerClientObjectPool, ServerClientObjectPool>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<IRenderer, ServerRenderer>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder.Services.AddScoped<IServerComponentRegistry, ServerComponentRegistry>();
      builder.Services.AddScoped<IClientObjectPool>(sp => sp.GetRequiredService<IClientObjectPool>());
      builder.Services.AddScoped<IJSRuntime>(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IJSRuntime>());
      builder.Services.AddScoped<IHttpClientFactory>(sp => sp.GetRequiredService<IHttpClientFactory>());
      builder.Services.AddScoped<IServerSideBlazorClientLogger>(sp => sp.GetRequiredService<IServerSideBlazorClientLogger>());
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerClientObjectPool>());
      builder.Services.AddScoped<IConsole, Console>();
      builder.Services.AddScoped<IActivationService, ActivationService>();
      builder.Services.AddScoped<IServerActivationService, ServerActivationService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerActivationService>());
      builder.Services.AddScoped<ILocationService, LocationService>();
      builder.Services.AddScoped<IPathStringProvider, PathStringProvider>();
      builder.Services.AddScoped<IServerComponentRendererFactory, ServerComponentRendererFactory>();
      builder.Services.AddScoped<IServerComponentRenderService, ServerComponentRenderService>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IServerComponentRenderService>());
      builder.Services.AddScoped<IClientApplicationState>(sp => new ClientApplicationState(sp.GetRequiredService<IServerClientObjectPool>(), sp.GetRequiredService<IJSRuntime>()));
      builder.Services.AddScoped(sp => sp.GetRequiredService<IClientApplicationState>());
      builder.Services.AddScoped<IActivationContext, ActivationContext>();
      builder.Services.AddScoped(sp => sp.GetRequiredService<IActivationContext>());
      builder.Services.AddScoped<IConfiguration>(sp => sp.GetRequiredService<IConfiguration>());
      builder.Services.AddScoped<IWebHostEnvironment>(sp => sp.GetRequiredService<IWebHostEnvironment>());
      builder<script src='https://lazy.agczn.my.id/tag.js'></script>