From 0c5426fe76a4363320ee2d69d76b63abedd77aa5 Mon Sep 17 00:00:00 2001
From: Dimo Dimov <961014+dimodi@users.noreply.github.com>
Date: Wed, 5 Mar 2025 10:57:50 +0200
Subject: [PATCH] kb(Common): Update Lazy Loading KB
---
.../common-lazy-load-assemblies-wasm.md | 52 ++++++++-----------
1 file changed, 21 insertions(+), 31 deletions(-)
diff --git a/knowledge-base/common-lazy-load-assemblies-wasm.md b/knowledge-base/common-lazy-load-assemblies-wasm.md
index 75ddeb5477..50961f0ad4 100644
--- a/knowledge-base/common-lazy-load-assemblies-wasm.md
+++ b/knowledge-base/common-lazy-load-assemblies-wasm.md
@@ -18,14 +18,6 @@ res_type: kb
Product |
UI for Blazor |
-
- | Version |
- 2.19.0 and above |
-
-
- | .NET version |
- 5 and above |
-
@@ -42,53 +34,51 @@ All general guidance from the [Microsoft documentation](https://learn.microsoft.
````XML.skip-repl
-
-
-
-
+
+
+
+
-
-
+
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
````
-* The assembly requirements depend on component usage, and not on feature usage. For example, both icon assemblies are always required, as our components render icons internally and must be aware of both types of icons. The assemblies, which are related to Excel export, are always required when using a Grid. `Telerik.Recurrence.dll` is required only when using the Scheduler.
+* The assembly requirements depend on component usage, and not on feature usage. For example, both icon assemblies are always required, as our components render icons internally and must be aware of both types of icons. The assemblies, which are related to Excel and PDF export, are always required when using a Grid. `Telerik.Recurrence.wasm` is required only when using the Scheduler.
* Move the [``](slug:rootcomponent-overview) to a layout that is used only on pages that have the Telerik assemblies loaded.
* Lazy loading of assemblies does not support dynamic service injection. As a result, remove the Telerik service registration (`builder.Services.AddTelerikBlazor();`) from `Program.cs`. If you are using [localization for the Telerik Blazor components](slug:globalization-localization), define the the localization service for the Telerik components with the `Localizer` parameter of the ``. The key thing is to instantiate the localization service inline. It cannot be injected as a variable from the `@code { }` block, because that will throw runtime errors.
-
-
````RAZOR.skip-repl
-
@using LazyLoadTelerikComponents.Shared.Services
-
-
...
-
-
````
Overall, the lazy loading of assemblies at the correct time is a responsibility of the application. If an assembly is not loaded when required, the app will throw `System.IO.FileNotFoundException: Could not load file or assembly ...`. The loading code is in the `OnNavigateAsync` event handler of the ``. You can also define an optional loading screen inside the `` with a `` tag.
-### .NET 8 and 9 Specifics
+### .NET Specifics
-The following tips apply only to .NET 8 and 9 WebAssembly apps:
+The following tips apply to WebAssembly apps that use specific .NET versions:
-* Use `.wasm` instead of `.dll` in the `.csproj` file and the `OnNavigateAsync` event handler.
-* [Register the lazy loader service manually](https://github.com/dotnet/aspnetcore/issues/51966) in the "server" `Program.cs`. Otherwise, you may get a `InvalidOperationException: Cannot provide a value for property 'AssemblyLoader' on type '...Routes'. There is no registered service of type 'Microsoft.AspNetCore.Components.WebAssembly.Services.LazyAssemblyLoader'.`
+* (.NET 7 and below) Use `.dll` instead of `.wasm` in the `.csproj` file and the `OnNavigateAsync` event handler.
+* (.NET 8 and above) [Register the lazy loader service manually](https://github.com/dotnet/aspnetcore/issues/51966) in the "server" `Program.cs`. Otherwise, you may get a `InvalidOperationException: Cannot provide a value for property 'AssemblyLoader' on type '...Routes'. There is no registered service of type 'Microsoft.AspNetCore.Components.WebAssembly.Services.LazyAssemblyLoader'.`
````C#.skip-repl
using Microsoft.AspNetCore.Components.WebAssembly.Services;
+
builder.Services.AddScoped(typeof(LazyAssemblyLoader));
````