From 2aedea0535d127e17a47fea96170ebaa205bd06c Mon Sep 17 00:00:00 2001 From: Konstantin Dinev Date: Thu, 19 Nov 2026 11:40:10 +0200 Subject: [PATCH 1/6] feat(dotnet-11): adding .NET 11 as target and dropping .NET 8, 9 --- .agents/context/project.md | 2 +- .../maintain-trim-compatibility/SKILL.md | 2 +- .agents/skills/write-library-tests/SKILL.md | 6 +-- .../references/interop-contracts.md | 2 +- .github/ISSUE_TEMPLATE/bug_report.yml | 4 +- .github/copilot-instructions.md | 2 +- .github/workflows/ci.yml | 14 +++--- .../igniteui-blazor-lite-release.yml | 2 +- .github/workflows/wasm-aot-smoke.yml | 13 ++---- CHANGELOG.md | 5 ++ Directory.Packages.props | 15 +++--- README.md | 2 +- ROADMAP.md | 1 + docs/TRIMMING.md | 4 +- docs/security/threat-model.md | 2 +- global.json | 2 +- src/IgniteUI.Blazor.Lite.csproj | 2 +- src/componentsBase/EventCallbackExtensions.cs | 46 ++----------------- src/componentsBase/IgbComponentBase.cs | 7 ++- src/componentsBase/InteropModule.cs | 28 +++++++++++ src/componentsBase/RuntimeHelper.cs | 7 ++- stories/IgniteUI.Blazor.Stories.csproj | 2 +- .../IgniteUI.Blazor.Lite.AotSmoke.csproj | 2 +- tests/IgniteUI.Blazor.Lite.AotSmoke/README.md | 2 +- ...niteUI.Blazor.Lite.IntegrationTests.csproj | 3 +- .../Infrastructure/TrimmedPublishServer.cs | 2 +- .../IgniteUI.Blazor.Lite.PublishSmoke.csproj | 4 +- .../README.md | 12 ++--- ...IgniteUI.Blazor.Lite.TestBed.Client.csproj | 5 +- .../Components/Pages/Home.razor | 2 +- .../IgniteUI.Blazor.Lite.TestBed.csproj | 5 +- .../ComponentWithContractTestBase.cs | 1 - .../IgniteUI.Blazor.Tests.csproj | 5 +- .../IgniteUI.Blazor.Tests/ScriptPropTests.cs | 9 ++-- 34 files changed, 112 insertions(+), 110 deletions(-) diff --git a/.agents/context/project.md b/.agents/context/project.md index 034ba249..76cf04e7 100644 --- a/.agents/context/project.md +++ b/.agents/context/project.md @@ -7,7 +7,7 @@ changes; if they disagree with this file, they win. ## Stack -- Language: C# (nullable annotations), multi-targeted `net8.0`, `net9.0`, `net10.0`; SDK pinned +- Language: C# (nullable annotations), multi-targeted `net10.0`, `net11.0`; SDK pinned in `global.json` - Framework: Blazor Razor class library (`IgniteUI.Blazor.Lite`) wrapping the `igniteui-webcomponents` custom elements diff --git a/.agents/skills/maintain-trim-compatibility/SKILL.md b/.agents/skills/maintain-trim-compatibility/SKILL.md index 7206f7e8..fa155b58 100644 --- a/.agents/skills/maintain-trim-compatibility/SKILL.md +++ b/.agents/skills/maintain-trim-compatibility/SKILL.md @@ -20,6 +20,6 @@ The library ships `IsTrimmable` + the AOT/single-file analyzers (`IsAotCompatibl ## Verification - `dotnet build src/IgniteUI.Blazor.Lite.csproj` must be free of IL diagnostics (they fail the build). -- For changes touching reflection, serialization, or annotations, run the automated browser checks over the trimmed publish: `dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings` (`TrimmedPublishSmokeTest`; publishes the smoke app net10.0 on demand). It is category-scoped — not part of the per-component integration sweep — and covers net10.0 only; the manual checklist in `tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md` covers the other TFMs. Trimming only happens at publish (`dotnet run` proves nothing). +- For changes touching reflection, serialization, or annotations, run the automated browser checks over the trimmed publish: `dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings` (`TrimmedPublishSmokeTest`; publishes the smoke app net11.0 on demand). It is category-scoped — not part of the per-component integration sweep — and covers net11.0 only; the manual checklist in `tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md` covers the other TFMs. Trimming only happens at publish (`dotnet run` proves nothing). - Verify claims about linker behavior empirically in the smoke app — a control-vs-fix publish pair, not reasoning from documentation alone. - For AOT changes: `tests/IgniteUI.Blazor.Lite.AotSmoke` runs the RequiresDynamicCode-adjacent paths under real ILC (CI does this on linux-x64; locally `dotnet run --project tests/IgniteUI.Blazor.Lite.AotSmoke -c Release -p:SimulateNoDynamicCode=true` covers the interpreter paths without the native toolchain — see its README). diff --git a/.agents/skills/write-library-tests/SKILL.md b/.agents/skills/write-library-tests/SKILL.md index f693d47c..275ca7a9 100644 --- a/.agents/skills/write-library-tests/SKILL.md +++ b/.agents/skills/write-library-tests/SKILL.md @@ -11,7 +11,7 @@ Three test projects under `tests/`, two suites: | Project | Suite | What it is | |---|---|---| -| `IgniteUI.Blazor.Tests` | **Unit** | xUnit + bUnit, multi-targeted `net8.0`/`net9.0`/`net10.0`; renders components in-process with a recording JS runtime — no browser | +| `IgniteUI.Blazor.Tests` | **Unit** | xUnit + bUnit, multi-targeted `net10.0`/`net11.0`; renders components in-process with a recording JS runtime — no browser | | `IgniteUI.Blazor.Lite.IntegrationTests` | **Integration** | NUnit + Playwright; one generated test fixture per component | | `IgniteUI.Blazor.Lite.TestBed` | (integration host) | Blazor app the integration tests drive; renders one component per run and sweeps its surface | @@ -41,10 +41,10 @@ The suites overlap on purpose but answer different questions. Integration proves ### Running ``` -dotnet test tests/IgniteUI.Blazor.Tests -f net10.0 --nologo --filter "FullyQualifiedName~Tests" +dotnet test tests/IgniteUI.Blazor.Tests -f net11.0 --nologo --filter "FullyQualifiedName~Tests" ``` -- Iterate on one TFM (`-f net10.0`); finish with a full run on all TFMs (drop `-f`). +- Iterate on one TFM (`-f net11.0`); finish with a full run on all TFMs (drop `-f`). - Contract failure stacks carry the violated contract line as the top frame — the test UI navigates to the spec, not the shared runner. ### Conventions diff --git a/.agents/skills/write-library-tests/references/interop-contracts.md b/.agents/skills/write-library-tests/references/interop-contracts.md index 22bcd036..301dce91 100644 --- a/.agents/skills/write-library-tests/references/interop-contracts.md +++ b/.agents/skills/write-library-tests/references/interop-contracts.md @@ -200,7 +200,7 @@ Contract failures carry the violated member and, as the top stack frame, the con ## Verify ``` -dotnet test tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj -f net10.0 --nologo --filter "FullyQualifiedName~Tests" +dotnet test tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj -f net11.0 --nologo --filter "FullyQualifiedName~Tests" ``` Common failures: diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 585d770a..3e1422aa 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -33,8 +33,8 @@ body: id: dotnet-version attributes: label: .NET Version - description: The version of .NET your project targets (e.g. 8.0, 9.0). - placeholder: e.g. 9.0 + description: The version of .NET your project targets (e.g. 10.0, 11.0). + placeholder: e.g. 11.0 validations: required: true diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index ba15188d..8701cfd8 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -76,7 +76,7 @@ This repository is the **source code for the Ignite UI for Blazor component libr ## Build & Tooling -- **Multi-target**: `net8.0`, `net9.0`, `net10.0` +- **Multi-target**: `net10.0`, `net11.0` - **C# build**: `dotnet build` - produces the Razor class library - **TS build**: `npm run build` - type-checks and bundles the JS interop (vite, ESM) into static web assets; `npm test` checks the built output diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5949e5a9..562b2db1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,15 +40,14 @@ jobs: - name: Checkout repository uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - # The SDK is pinned via global.json (10.0.x builds all TFMs); - # older runtimes are needed to run tests targeting net8.0/net9.0. + # The SDK is pinned via global.json (11.0.x builds all TFMs); + # the 10.0 runtime is needed to run tests targeting net10.0. - name: Setup .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: dotnet-version: | - 8.0.x - 9.0.x 10.0.x + 11.0.x # Folder mode formats files directly without loading MSBuild projects — # full `dotnet format` corrupts sources on multi-targeted projects @@ -83,9 +82,8 @@ jobs: # Trimmed publish of the smoke app fails on any linker warning; publish runs per TFM - name: Publish trimmed smoke app run: | - dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net8.0 - dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net9.0 dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net10.0 + dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net11.0 # NativeAOT (ILC) gate: publishes the console smoke app rooting the whole library # (fails on ILC warnings) and runs its checks — behavior the build analyzer cannot see. @@ -94,7 +92,7 @@ jobs: run: | dotnet publish tests/IgniteUI.Blazor.Lite.AotSmoke --configuration Release -r linux-x64 status=0 - tests/IgniteUI.Blazor.Lite.AotSmoke/bin/Release/net10.0/linux-x64/publish/IgniteUI.Blazor.Lite.AotSmoke || status=$? + tests/IgniteUI.Blazor.Lite.AotSmoke/bin/Release/net11.0/linux-x64/publish/IgniteUI.Blazor.Lite.AotSmoke || status=$? test "$status" -eq 100 - name: Run .NET tests with coverage @@ -107,7 +105,7 @@ jobs: - name: Install Playwright shell: pwsh - run: ./tests/IgniteUI.Blazor.Lite.IntegrationTests/bin/Release/net10.0/playwright.ps1 install + run: ./tests/IgniteUI.Blazor.Lite.IntegrationTests/bin/Release/net11.0/playwright.ps1 install - name: Run Bulk API Automation run: > diff --git a/.github/workflows/igniteui-blazor-lite-release.yml b/.github/workflows/igniteui-blazor-lite-release.yml index 556d9fab..7095b517 100644 --- a/.github/workflows/igniteui-blazor-lite-release.yml +++ b/.github/workflows/igniteui-blazor-lite-release.yml @@ -11,7 +11,7 @@ concurrency: env: BUILD_CONFIGURATION: Release - DOTNET_VERSION: "10.0.x" + DOTNET_VERSION: "11.0.x" NODE_VERSION: "22" VERSION: ${{ github.ref_name }} PACKAGE_ID: IgniteUI.Blazor.Lite diff --git a/.github/workflows/wasm-aot-smoke.yml b/.github/workflows/wasm-aot-smoke.yml index e972baff..840ae38a 100644 --- a/.github/workflows/wasm-aot-smoke.yml +++ b/.github/workflows/wasm-aot-smoke.yml @@ -21,10 +21,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: - dotnet-version: | - 8.0.x - 9.0.x - 10.0.x + dotnet-version: 11.0.x - name: Setup Node.js uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 @@ -41,17 +38,17 @@ jobs: - name: Install wasm-tools workload run: dotnet workload install wasm-tools - # Restore ignores --framework, and restoring net8/net9 with AOT on needs wasm-tools-net8/-net9. - # TargetFrameworks limits restore to net10. + # Restore ignores --framework, and restoring net10 with AOT on needs wasm-tools-net10. + # TargetFrameworks limits restore to net11. - name: Publish smoke app with AOT compilation - run: dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net10.0 -p:TargetFrameworks=net10.0 -p:RunAOTCompilation=true + run: dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net11.0 -p:TargetFrameworks=net11.0 -p:RunAOTCompilation=true - name: Build integration tests run: dotnet build tests/IgniteUI.Blazor.Lite.IntegrationTests --configuration Release - name: Install Playwright shell: pwsh - run: ./tests/IgniteUI.Blazor.Lite.IntegrationTests/bin/Release/net10.0/playwright.ps1 install + run: ./tests/IgniteUI.Blazor.Lite.IntegrationTests/bin/Release/net11.0/playwright.ps1 install # The TrimmedPublish fixture serves whatever publish output exists — here, the AOT-compiled one. - name: Run browser checks against the AOT publish diff --git a/CHANGELOG.md b/CHANGELOG.md index 2852969e..2bb79a98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Breaking Changes + +- The library targets `net10.0` and `net11.0`. It no longer targets `net8.0` and `net9.0`, which reach the end of support with the release of .NET 11. Apps on .NET 8 or 9 stay on 1.0.x; to update, retarget the app to .NET 10 or later. +- Apps on .NET 11 WebAssembly need a browser that supports WebAssembly exception handling (`exnref`); see the [Blazor supported platforms](https://learn.microsoft.com/aspnet/core/blazor/supported-platforms). The .NET 11 runtime does not start in older browsers. This is a requirement of .NET 11, not of the library. + ## 1.0.1 - 2026-10-29 ### Fixed diff --git a/Directory.Packages.props b/Directory.Packages.props index 725ac663..b4cdcdc1 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -4,23 +4,21 @@ true - - - + - - - + + - + @@ -29,9 +27,8 @@ - - + diff --git a/README.md b/README.md index e1a6877d..c912ba53 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ The [skills/](skills/README.md) directory contains skill files and an `AGENTS.md ## Building and Running Locally -**Prerequisites:** [.NET SDK](https://dotnet.microsoft.com/download) 10.0 and [Node.js](https://nodejs.org/) 22.12 or later (the Vite build requires it). The library targets `net8.0`, `net9.0` and `net10.0`. +**Prerequisites:** [.NET SDK](https://dotnet.microsoft.com/download) 11.0 and [Node.js](https://nodejs.org/) 22.12 or later (the Vite build requires it). The library targets `net10.0` and `net11.0`. ```bash # 1. Install Node dependencies diff --git a/ROADMAP.md b/ROADMAP.md index 5393989b..7f42ffcf 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -10,6 +10,7 @@ 4. **[DONE]** Aligned to `igniteui-webcomponents@7.3.2` - QR code image export, Chip `Outlined`, Splitter collapsed panes and `LayoutChanged`, Tabs `SelectedTab`, Icon registration options 5. **[DONE]** `IgbBreadcrumbs` - navigation trail of `IgbBreadcrumb` items with a configurable separator icon 6. **[DONE]** Aligned to `igniteui-webcomponents@7.4.1` - popup `ScrollStrategy` on Combo, Select, Dropdown, Date Picker, Date Range Picker, Color Picker and Tooltip, native CSS anchor positioning, Button Group radio keyboard pattern +7. **[DONE]** .NET 11 support - the library targets `net10.0` and `net11.0`; `net8.0` and `net9.0` are dropped with their end of support ## Going down the road diff --git a/docs/TRIMMING.md b/docs/TRIMMING.md index 03dfa87c..bee406a7 100644 --- a/docs/TRIMMING.md +++ b/docs/TRIMMING.md @@ -55,13 +55,13 @@ AOT diagnostics (IL3xxx) build as errors like trim ones (`dotnet_analyzer_diagno 1. **Avoid dynamic code outright** where a static shape exists. 2. **Expression trees: the delegate type must be statically known** — use `Expression.Lambda(...)` or `Expression.Lambda(Type delegateType, ...)` with a `typeof` literal (see the closed delegate-type map in `JsonDataSourceSchema`). Never `Expression.GetFuncType` or the non-generic `Lambda(body, params)` overloads — those are the `RequiresDynamicCode` sites; `Compile()` itself is AOT-safe (interprets). -3. **`MakeGenericType`/`MakeGenericMethod` only over closed sets** that are statically visible or class-constrained (the net9+ analyzer proves the `where T : class` pattern; net8 needs a narrow suppression). +3. **`MakeGenericType`/`MakeGenericMethod` only over closed sets** that are statically visible or class-constrained (the analyzer proves the `where T : class` pattern). 4. **Suppression policy**: `[UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode", Justification = ...)]` on the smallest member — the ID is what ILC matches; the justification states the runtime invariant. Same no-`#pragma` rule as trimming. 5. **Verify under real ILC**: `tests/IgniteUI.Blazor.Lite.AotSmoke` (see its README) — CI publishes and runs it; locally `dotnet run -p:SimulateNoDynamicCode=true` covers the interpreter paths without the native toolchain. ## Maintaining trim compatibility (contributors) -The library must stay trim-clean. Every trim-analysis diagnostic builds as an error (`dotnet_analyzer_diagnostic.category-Trimming.severity = error` in the repo `.editorconfig`; category bulk-config covers future IL2xxx codes, inert where the analyzer is off). The analyzer cannot validate suppression justifications or retention-based mechanisms like `[IgbModule]` — `tests/IgniteUI.Blazor.Lite.PublishSmoke` is the authoritative check for those, automated as the `TrimmedPublish`-category browser facts in `IgniteUI.Blazor.Lite.IntegrationTests` (net10.0, runs in CI); its README has the manual checklist covering the other TFMs. +The library must stay trim-clean. Every trim-analysis diagnostic builds as an error (`dotnet_analyzer_diagnostic.category-Trimming.severity = error` in the repo `.editorconfig`; category bulk-config covers future IL2xxx codes, inert where the analyzer is off). The analyzer cannot validate suppression justifications or retention-based mechanisms like `[IgbModule]` — `tests/IgniteUI.Blazor.Lite.PublishSmoke` is the authoritative check for those, automated as the `TrimmedPublish`-category browser facts in `IgniteUI.Blazor.Lite.IntegrationTests` (net11.0, runs in CI); its README has the manual checklist covering the other TFMs. When the analyzer flags new code, follow the standard playbook — avoid reflection and dynamic code where possible, otherwise annotate or fix the root cause, and suppress only as a last resort: see [preparing libraries for trimming: recommendations](https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming#recommendations) and [resolving trim warnings](https://learn.microsoft.com/dotnet/core/deploying/trimming/fixing-warnings). Repo-specific rules on top: diff --git a/docs/security/threat-model.md b/docs/security/threat-model.md index 135eb9e0..58adcf1e 100644 --- a/docs/security/threat-model.md +++ b/docs/security/threat-model.md @@ -98,7 +98,7 @@ Content the application renders *inside* a component is the application's own co | Bound data reaches the browser beyond what is displayed | Data-bound components serialize the **public properties and fields** of the bound item type, not only the members a template happens to render. The transfer happens once the component is interactive; static SSR and prerendered HTML carry no bound data ([§3](#3-trust-boundaries-by-hosting-model)). Narrow the type before binding; see *Bind projections, not entities* in [§5](#5-guidance-for-application-developers). | | Interop payloads appear in logs | The managed library logs no event arguments, renderer messages or bound values; it writes caught exceptions to the console. The browser bundle reports interop failures to the developer console, so a failing call can surface fragments of its payload there. | -Not a threat, recorded because [§3](#3-trust-boundaries-by-hosting-model) refers to it: the unmarshalled data channel depends on the .NET writer and the JavaScript reader agreeing on a fixed column layout. The channel uses `InvokeUnmarshalled` where the in-process runtime still offers it (.NET 8) and raw pointers otherwise (.NET 9 and later). Unit tests drive the writer on every target framework through a test double; the real browser transport is exercised only on .NET 10 by the Playwright suite. In the other interactive models, and when the application opts for JSON, the same data travels as JSON. +Not a threat, recorded because [§3](#3-trust-boundaries-by-hosting-model) refers to it: the unmarshalled data channel depends on the .NET writer and the JavaScript reader agreeing on a fixed column layout. The channel passes the writer's data to the reader as a raw pointer into the WebAssembly heap. Unit tests drive the writer on every target framework through a test double; the real browser transport is exercised only on .NET 11 by the Playwright suite. In the other interactive models, and when the application opts for JSON, the same data travels as JSON. ## 5. Guidance for application developers diff --git a/global.json b/global.json index 512142d2..e26c590b 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.100", + "version": "11.0.100", "rollForward": "latestFeature" } } diff --git a/src/IgniteUI.Blazor.Lite.csproj b/src/IgniteUI.Blazor.Lite.csproj index 45acaf79..adce8177 100644 --- a/src/IgniteUI.Blazor.Lite.csproj +++ b/src/IgniteUI.Blazor.Lite.csproj @@ -20,7 +20,7 @@ - net8.0;net9.0;net10.0 + net10.0;net11.0 diff --git a/src/componentsBase/EventCallbackExtensions.cs b/src/componentsBase/EventCallbackExtensions.cs index 36822745..244c301b 100644 --- a/src/componentsBase/EventCallbackExtensions.cs +++ b/src/componentsBase/EventCallbackExtensions.cs @@ -1,6 +1,3 @@ -#if !NET10_0_OR_GREATER -using System.Reflection; -#endif using Microsoft.AspNetCore.Components; namespace IgniteUI.Blazor.Controls @@ -16,47 +13,14 @@ internal static bool HasHandler(this EventCallback callback) => callback.HasDelegate && !EventCallback.Empty.Equals(callback); /// - /// Workaround for . - /// It has been fixed only in .NET ~9~ 10.(dotnet/aspnetcore#53361). + /// Whether is set and equal to : the same receiver and an + /// equal delegate, so the fresh delegate Blazor hands over for the same handler on each render compares equal. + /// does this since .NET 10 + /// (dotnet/aspnetcore#53361). /// internal static bool EqualsCompat(this EventCallback left, EventCallback? right) { - if (right == null) - { - return false; - } - - EventCallback other = right.Value; -#if NET10_0_OR_GREATER - return left.Equals(other); -#else - if (!CallbackFields.Resolved) - { - return false; - } - - // Mirrors .NET 10's EventCallback.Equals, need the internal fields for the checks: - MulticastDelegate? leftDelegate = (MulticastDelegate?)CallbackFields.Delegate?.GetValue(left); - MulticastDelegate? rightDelegate = (MulticastDelegate?)CallbackFields.Delegate?.GetValue(other); - - return ReferenceEquals(CallbackFields.Receiver?.GetValue(left), CallbackFields.Receiver?.GetValue(other)) - && (leftDelegate?.Equals(rightDelegate) ?? (rightDelegate == null)); -#endif - } - -#if !NET10_0_OR_GREATER - /// Resolved once per closed callback type, rather than per component instance. - private static class CallbackFields - { - internal static readonly FieldInfo? Delegate = Field("Delegate"); - internal static readonly FieldInfo? Receiver = Field("Receiver"); - - /// Use as guard against (unlikely) fields rename in old versions that won't resolve. - internal static readonly bool Resolved = Delegate != null && Receiver != null; - - private static FieldInfo? Field(string name) => - typeof(EventCallback).GetField(name, BindingFlags.NonPublic | BindingFlags.Instance); + return right != null && left.Equals(right.Value); } -#endif } } diff --git a/src/componentsBase/IgbComponentBase.cs b/src/componentsBase/IgbComponentBase.cs index 46f75679..9087126e 100644 --- a/src/componentsBase/IgbComponentBase.cs +++ b/src/componentsBase/IgbComponentBase.cs @@ -1716,7 +1716,7 @@ private void SendJson(string json, ElementReference[]? nativeElements) var args = nativeElements != null ? new object[] { this._containerId, json, GetObjectRef(), nativeElements } : new object[] { this._containerId, json, GetObjectRef() }; - Interop.Post(module => _ = module.InvokeAsync("sendMessage", args)); + Interop.PostVoid("sendMessage", args); } internal void AttachChild(BaseJsonSerializable child) @@ -1783,6 +1783,8 @@ private object SendJsonSync(string json, ElementReference[]? nativeElements) } var module = Interop.LoadedInProcess ?? throw new InvalidOperationException("The Ignite UI client interop module is not loaded yet; await EnsureReady() or use the async method."); + // A sync method call: its caller gets the failure, as it would from the web component method itself. +#pragma warning disable BL0016 // JS interop call is not guarded with a try/catch block if (nativeElements != null) { return module.Invoke("sendMessage", @@ -1797,6 +1799,7 @@ private object SendJsonSync(string json, ElementReference[]? nativeElements) this._containerId, json, GetObjectRef() }); } +#pragma warning restore BL0016 } internal object? ReturnToPrimitive(object? returnValue) @@ -3861,7 +3864,7 @@ public void RequestLoad(string moduleName) return; } _loadedCache.AddOrUpdate(moduleName, true, (name, oldValue) => true); - GetInteropModule(InteropModule.LitePath).Post(module => _ = module.InvokeVoidAsync("requestLoad", moduleName)); + GetInteropModule(InteropModule.LitePath).PostVoid("requestLoad", moduleName); } private readonly ConcurrentDictionary _interopModules = new ConcurrentDictionary(); diff --git a/src/componentsBase/InteropModule.cs b/src/componentsBase/InteropModule.cs index 80a00e9c..58385d06 100644 --- a/src/componentsBase/InteropModule.cs +++ b/src/componentsBase/InteropModule.cs @@ -79,6 +79,33 @@ internal void Post(Action call) call(module); } + /// + /// Posts a call that nothing awaits, such as a message to the client. Its failure when the circuit goes + /// away is expected and dropped; any other failure stays unobserved, as a discarded task's would. + /// + internal void PostVoid(string identifier, params object?[]? args) + { + Post(module => _ = InvokeAndForgetAsync(module, identifier, args)); + } + + private static async Task InvokeAndForgetAsync(IJSObjectReference module, string identifier, object?[]? args) + { + try + { + await module.InvokeVoidAsync(identifier, args).ConfigureAwait(false); + } + catch (JSDisconnectedException) + { + // The circuit is gone; there is no client left to update. + } + catch (OperationCanceledException) + { + // The call was canceled with the circuit or runtime. + } + } + + // Awaited calls: the caller gets the failure, so it can handle it as its own. +#pragma warning disable BL0016 // JS interop call is not guarded with a try/catch block internal async ValueTask InvokeAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)] TValue>(string identifier, params object?[]? args) { var module = _module ?? await GetAsync().ConfigureAwait(false); @@ -90,6 +117,7 @@ internal async ValueTask InvokeVoidAsync(string identifier, params object?[]? ar var module = _module ?? await GetAsync().ConfigureAwait(false); await module.InvokeVoidAsync(identifier, args).ConfigureAwait(false); } +#pragma warning restore BL0016 private async Task LoadAsync() { diff --git a/src/componentsBase/RuntimeHelper.cs b/src/componentsBase/RuntimeHelper.cs index 820cf6ef..8fee94ec 100644 --- a/src/componentsBase/RuntimeHelper.cs +++ b/src/componentsBase/RuntimeHelper.cs @@ -5,8 +5,10 @@ namespace IgniteUI.Blazor.Controls { // Sends unmarshalled data (WebAssembly) to the component's client interop module: a synchronous in-process call // that passes the address of the local holding the columns array, which the client reads off the heap for the - // duration of the call. The same path on every target framework (the net8-only InvokeUnmarshalled fast path - // needed a window global). + // duration of the call. The same path on every target framework. + // The calls are in-process (WebAssembly, no circuit to lose): a client error reaches the code that changed + // the data, so they are not wrapped in try/catch. +#pragma warning disable BL0016 // JS interop call is not guarded with a try/catch block internal class RuntimeHelper { private readonly IIgniteUIBlazorRuntime? _igBlazor; @@ -67,6 +69,7 @@ private static unsafe void SendUnmarshalledColumnMessageNow(IJSObjectReference m public bool IsInproc { get; private set; } public bool IsForcedJsonDataMarshalling { get { return _igBlazor?.Settings?.ForceJsonDataMarshalling ?? false; } } } +#pragma warning restore BL0016 /// /// A module that takes the column arrays themselves instead of their address, which only a WebAssembly heap diff --git a/stories/IgniteUI.Blazor.Stories.csproj b/stories/IgniteUI.Blazor.Stories.csproj index 49947f15..4e70af0b 100644 --- a/stories/IgniteUI.Blazor.Stories.csproj +++ b/stories/IgniteUI.Blazor.Stories.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 True global::BlazingStory.Internals.Pages.MarkdownPageBase diff --git a/tests/IgniteUI.Blazor.Lite.AotSmoke/IgniteUI.Blazor.Lite.AotSmoke.csproj b/tests/IgniteUI.Blazor.Lite.AotSmoke/IgniteUI.Blazor.Lite.AotSmoke.csproj index 377ad7ef..d302a5aa 100644 --- a/tests/IgniteUI.Blazor.Lite.AotSmoke/IgniteUI.Blazor.Lite.AotSmoke.csproj +++ b/tests/IgniteUI.Blazor.Lite.AotSmoke/IgniteUI.Blazor.Lite.AotSmoke.csproj @@ -4,7 +4,7 @@ paths — the runtime gate for behavior the AOT analyzer cannot verify. See README.md. --> Exe - net10.0 + net11.0 enable true false diff --git a/tests/IgniteUI.Blazor.Lite.AotSmoke/README.md b/tests/IgniteUI.Blazor.Lite.AotSmoke/README.md index 755be149..e49a5b67 100644 --- a/tests/IgniteUI.Blazor.Lite.AotSmoke/README.md +++ b/tests/IgniteUI.Blazor.Lite.AotSmoke/README.md @@ -18,7 +18,7 @@ Main must not construct any ComponentBase-derived type (components, event args): # Real thing (CI runs this on linux-x64; locally needs the native toolchain — # VS "Desktop development with C++" on Windows, clang + zlib1g-dev on Linux): dotnet publish tests/IgniteUI.Blazor.Lite.AotSmoke -c Release -r win-x64 -tests/IgniteUI.Blazor.Lite.AotSmoke/bin/Release/net10.0/win-x64/publish/IgniteUI.Blazor.Lite.AotSmoke.exe +tests/IgniteUI.Blazor.Lite.AotSmoke/bin/Release/net11.0/win-x64/publish/IgniteUI.Blazor.Lite.AotSmoke.exe # No native toolchain: run on CoreCLR with dynamic code disabled — forces the same # interpreter paths ILC uses at runtime (does NOT validate ILC analysis or codegen): diff --git a/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj b/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj index 8190e406..55646984 100644 --- a/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj +++ b/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net10.0 + net11.0 false true @@ -9,7 +9,6 @@ - diff --git a/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs b/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs index d91bb4a5..a7eddcd2 100644 --- a/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs +++ b/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs @@ -13,7 +13,7 @@ namespace IgniteUI.Blazor.Lite.IntegrationTests.Infrastructure /// internal sealed class TrimmedPublishServer : IAsyncDisposable { - private const string Tfm = "net10.0"; + private const string Tfm = "net11.0"; private readonly WebApplication app; diff --git a/tests/IgniteUI.Blazor.Lite.PublishSmoke/IgniteUI.Blazor.Lite.PublishSmoke.csproj b/tests/IgniteUI.Blazor.Lite.PublishSmoke/IgniteUI.Blazor.Lite.PublishSmoke.csproj index 1f8d621c..3c255497 100644 --- a/tests/IgniteUI.Blazor.Lite.PublishSmoke/IgniteUI.Blazor.Lite.PublishSmoke.csproj +++ b/tests/IgniteUI.Blazor.Lite.PublishSmoke/IgniteUI.Blazor.Lite.PublishSmoke.csproj @@ -4,8 +4,8 @@ and, via the manual Wasm AOT Smoke workflow, under wasm AOT compilation (-p:RunAOTCompilation=true), exercising the reflection-adjacent features in the browser. See docs/TRIMMING.md. --> - - net8.0;net9.0;net10.0 + + net10.0;net11.0 enable diff --git a/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md b/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md index edfde168..9061aaa3 100644 --- a/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md +++ b/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md @@ -11,10 +11,10 @@ No — the trimmer (ILLink) only runs during **publish**. `dotnet run`/`dotnet b ```bash # 1. Publish trimmed (from the repo root). The app multi-targets the library's TFMs; # publish requires picking one — check all three after linker-sensitive changes. -dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke -c Release -f net10.0 +dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke -c Release -f net11.0 # 2. Serve the publish output (any static file server works; npx needs no install — Node is a repo prerequisite): -npx http-server tests/IgniteUI.Blazor.Lite.PublishSmoke/bin/Release/net10.0/publish/wwwroot -p 5620 +npx http-server tests/IgniteUI.Blazor.Lite.PublishSmoke/bin/Release/net11.0/publish/wwwroot -p 5620 # 3. Open http://localhost:5620/ and check the page against the table below. ``` @@ -37,7 +37,7 @@ Three gates, in order of what they can see: | Chat message reads `Message: Hello from a trimmed app` | the Razor `MessageContent` renderer's output inside the chat | the renderer context lost its constructor — the library builds `IgbChatMessageRenderContext` itself and the app never does | | Browser console | no errors (a stray `favicon` 404 is fine) | anything else: investigate | -The checklist is automated as `TrimmedPublishSmokeTest` in `IgniteUI.Blazor.Lite.IntegrationTests` (`Category=TrimmedPublish`, runs in CI after the publish step). It serves the net10.0 publish output — publishing it on demand if missing — so locally it's just: +The checklist is automated as `TrimmedPublishSmokeTest` in `IgniteUI.Blazor.Lite.IntegrationTests` (`Category=TrimmedPublish`, runs in CI after the publish step). It serves the net11.0 publish output — publishing it on demand if missing — so locally it's just: ```bash dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings @@ -47,15 +47,15 @@ The manual browser pass above remains useful for the other TFMs and for linker e ## Wasm AOT -The manual **`Wasm AOT Smoke`** workflow (`workflow_dispatch`) publishes this app with `-p:RunAOTCompilation=true` (net10.0, slow multi-minute compile) and runs the same browser checks against that output. Locally: +The manual **`Wasm AOT Smoke`** workflow (`workflow_dispatch`) publishes this app with `-p:RunAOTCompilation=true` (net11.0, slow multi-minute compile) and runs the same browser checks against that output. Locally: ```bash dotnet workload install wasm-tools -dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke -c Release -f net10.0 -p:TargetFrameworks=net10.0 -p:RunAOTCompilation=true +dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke -c Release -f net11.0 -p:TargetFrameworks=net11.0 -p:RunAOTCompilation=true dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings ``` -Restore ignores `-f`, and restoring net8/net9 with AOT on needs `wasm-tools-net8`/`wasm-tools-net9`. `-p:TargetFrameworks=net10.0` limits restore to net10. +Restore ignores `-f`, and restoring net10 with AOT on needs `wasm-tools-net10`. `-p:TargetFrameworks=net11.0` limits restore to net11. Wasm AOT is Mono AOT with the interpreter retained — it validates the product path but emits no NativeAOT diagnostics; that gate is `tests/IgniteUI.Blazor.Lite.AotSmoke` (per-PR CI). diff --git a/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj b/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj index 69cbc4af..0369f596 100644 --- a/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj +++ b/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj @@ -1,7 +1,10 @@ - net10.0 + net11.0 + + $(NoWarn);BL0016 true diff --git a/tests/IgniteUI.Blazor.Lite.TestBed/Components/Pages/Home.razor b/tests/IgniteUI.Blazor.Lite.TestBed/Components/Pages/Home.razor index 6f04e448..2c5d02ab 100644 --- a/tests/IgniteUI.Blazor.Lite.TestBed/Components/Pages/Home.razor +++ b/tests/IgniteUI.Blazor.Lite.TestBed/Components/Pages/Home.razor @@ -466,7 +466,7 @@ break; } - await JS.InvokeAsync("triggerEvent", evtName, argDetailToSend, detailType == typeof(DateTime)); + await JS.InvokeVoidAsync("triggerEvent", evtName, argDetailToSend, detailType == typeof(DateTime)); } if (eventMessage != evt.Name) diff --git a/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj b/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj index c5682242..194966e5 100644 --- a/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj +++ b/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj @@ -1,7 +1,10 @@  - net10.0 + net11.0 + + $(NoWarn);BL0016 diff --git a/tests/IgniteUI.Blazor.Tests/ComponentWithContractTestBase.cs b/tests/IgniteUI.Blazor.Tests/ComponentWithContractTestBase.cs index 037d5e1a..3ef36427 100644 --- a/tests/IgniteUI.Blazor.Tests/ComponentWithContractTestBase.cs +++ b/tests/IgniteUI.Blazor.Tests/ComponentWithContractTestBase.cs @@ -511,7 +511,6 @@ protected void VerifyEventContract() // Re-binding an equivalent callback must not read as a new subscription — Blazor hands over a // fresh delegate for the same handler every render. Read through the member (a setter assigns // and registers in one branch) since probing the wire for an absent message costs a 2s retry. - // Only bites on net8.0/net9.0, whose EventCallback.Equals compares the delegate by reference. cut.Render(ps => evt.Bind(ps, Sink)); Assert.Equal(bound, evt.Get(cut.Instance)); diff --git a/tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj b/tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj index e63b7884..a499c6ae 100644 --- a/tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj +++ b/tests/IgniteUI.Blazor.Tests/IgniteUI.Blazor.Tests.csproj @@ -3,8 +3,11 @@ - net8.0;net9.0;net10.0 + net10.0;net11.0 false + + $(NoWarn);BL0016 diff --git a/tests/IgniteUI.Blazor.Tests/ScriptPropTests.cs b/tests/IgniteUI.Blazor.Tests/ScriptPropTests.cs index 75df9511..4764dd41 100644 --- a/tests/IgniteUI.Blazor.Tests/ScriptPropTests.cs +++ b/tests/IgniteUI.Blazor.Tests/ScriptPropTests.cs @@ -43,11 +43,10 @@ public static TheoryData ComponentsWithScriptProps() var closed = type.IsGenericTypeDefinition ? type.MakeGenericType(type.Name[..type.Name.IndexOf('`')] switch { - // TODO: generic object fallback due to nameof(T<>) being C# 14 / .NET 10 only - nameof(IgbCalendar) or nameof(IgbDatePicker) or nameof(IgbDateTimeInput) or nameof(IgbDateRangePicker) => new Type[] { typeof(DateTime) }, - nameof(IgbSlider) or nameof(IgbRating) => new Type[] { typeof(double) }, - nameof(IgbColorPicker) or nameof(IgbSelect) => new Type[] { typeof(string) }, - nameof(IgbCombo) => new Type[] { typeof(object), typeof(object) }, + nameof(IgbCalendar<>) or nameof(IgbDatePicker<>) or nameof(IgbDateTimeInput<>) or nameof(IgbDateRangePicker<>) => new Type[] { typeof(DateTime) }, + nameof(IgbSlider<>) or nameof(IgbRating<>) => new Type[] { typeof(double) }, + nameof(IgbColorPicker<>) or nameof(IgbSelect<>) => new Type[] { typeof(string) }, + nameof(IgbCombo<,>) => new Type[] { typeof(object), typeof(object) }, _ => new Type[] { typeof(object) } }) : type; From 2c630c75a5c2b043eca907ef34a9c16aa187451f Mon Sep 17 00:00:00 2001 From: Konstantin Dinev Date: Wed, 25 Nov 2026 10:39:41 +0200 Subject: [PATCH 2/6] chore(*): addressing review comments --- src/componentsBase/InteropModule.cs | 3 +- .../InteropModuleTests.cs | 129 +++++++++++++++++- 2 files changed, 129 insertions(+), 3 deletions(-) diff --git a/src/componentsBase/InteropModule.cs b/src/componentsBase/InteropModule.cs index 58385d06..dfee5e75 100644 --- a/src/componentsBase/InteropModule.cs +++ b/src/componentsBase/InteropModule.cs @@ -88,7 +88,8 @@ internal void PostVoid(string identifier, params object?[]? args) Post(module => _ = InvokeAndForgetAsync(module, identifier, args)); } - private static async Task InvokeAndForgetAsync(IJSObjectReference module, string identifier, object?[]? args) + // Internal so tests can await the task that PostVoid discards and check which failures are dropped. + internal static async Task InvokeAndForgetAsync(IJSObjectReference module, string identifier, object?[]? args) { try { diff --git a/tests/IgniteUI.Blazor.Tests/InteropModuleTests.cs b/tests/IgniteUI.Blazor.Tests/InteropModuleTests.cs index b8661845..f195ef7b 100644 --- a/tests/IgniteUI.Blazor.Tests/InteropModuleTests.cs +++ b/tests/IgniteUI.Blazor.Tests/InteropModuleTests.cs @@ -95,6 +95,115 @@ public async Task DisposeAsync_WhileImporting_DisposesTheModuleOnceItArrives() Assert.Null(interop.Loaded); } + [Fact] + public async Task PostVoid_WhileImporting_InvokesInCallOrderWithArguments() + { + var js = new FakeJSRuntime(); + var interop = new InteropModule(js, "./m.js"); + + interop.PostVoid("first", 1, "a"); + interop.PostVoid("second"); + Assert.Empty(js.Module.Invocations); + + js.CompleteImport(); + await interop.GetAsync(); + + Assert.Collection(js.Module.Invocations, + i => { Assert.Equal("first", i.Identifier); Assert.Equal(new object?[] { 1, "a" }, i.Args); }, + i => { Assert.Equal("second", i.Identifier); Assert.Empty(i.Args!); }); + } + + [Fact] + public async Task PostVoid_AfterImport_InvokesImmediately() + { + var js = new FakeJSRuntime(); + var interop = new InteropModule(js, "./m.js"); + var load = interop.GetAsync(); + js.CompleteImport(); + await load; + + interop.PostVoid("send", "msg"); + + var invocation = Assert.Single(js.Module.Invocations); + Assert.Equal("send", invocation.Identifier); + Assert.Equal(new object?[] { "msg" }, invocation.Args); + } + + public static TheoryData FailureModes => new TheoryData + { + "throws", "faults", "disconnects", "cancels", + }; + + [Theory] + [MemberData(nameof(FailureModes))] + public async Task PostVoid_InvocationFailing_DoesNotStopLaterCalls(string failure) + { + var js = new FakeJSRuntime(); + var interop = new InteropModule(js, "./m.js"); + js.Module.Behavior = (identifier, _) => identifier == "bad" ? Fail(failure) : default; + + // Queued: dispatched by the import's drain loop. + interop.PostVoid("bad"); + interop.PostVoid("good", 1); + js.CompleteImport(); + await interop.GetAsync(); + Assert.NotNull(interop.Loaded); + + // Already loaded: dispatched directly. + interop.PostVoid("bad"); + interop.PostVoid("good", 2); + + Assert.Equal(new[] { "bad", "good", "bad", "good" }, js.Module.Invocations.Select(i => i.Identifier)); + } + + [Theory] + [InlineData("disconnects")] + [InlineData("cancels")] + public async Task InvokeAndForgetAsync_CircuitGone_CompletesSuccessfully(string failure) + { + var module = new FakeModule { Behavior = (_, _) => Fail(failure) }; + + var task = InteropModule.InvokeAndForgetAsync(module, "send", new object?[] { "msg" }); + await task; + + Assert.True(task.IsCompletedSuccessfully); + Assert.Equal("send", Assert.Single(module.Invocations).Identifier); + } + + [Theory] + [InlineData("throws")] + [InlineData("faults")] + public async Task InvokeAndForgetAsync_OtherFailure_FaultsTheTask(string failure) + { + var module = new FakeModule { Behavior = (_, _) => Fail(failure) }; + + var task = InteropModule.InvokeAndForgetAsync(module, "send", null); + + await Assert.ThrowsAsync(() => task); + Assert.True(task.IsFaulted); + } + + private static ValueTask Fail(string failure) => failure switch + { + "throws" => throw new JSException("boom"), + "faults" => FaultLater(new JSException("boom")), + "disconnects" => FaultLater(new JSDisconnectedException("gone")), + "cancels" => CancelLater(), + _ => throw new ArgumentOutOfRangeException(nameof(failure)), + }; + + private static async ValueTask FaultLater(Exception ex) + { + await Task.Yield(); + throw ex; + } + + private static async ValueTask CancelLater() + { + await Task.Yield(); + throw new TaskCanceledException(); + } + private sealed class FakeJSRuntime : IJSRuntime { private TaskCompletionSource? _import; @@ -131,14 +240,30 @@ private sealed class FakeModule : IJSObjectReference { public bool Disposed { get; private set; } + public List<(string Identifier, object?[]? Args)> Invocations { get; } = new(); + + // What an invocation does; it may throw synchronously, as a real call can before its task is created. + public Func Behavior { get; set; } = (_, _) => default; + public ValueTask DisposeAsync() { Disposed = true; return ValueTask.CompletedTask; } - public ValueTask InvokeAsync(string identifier, object?[]? args) => default; + public ValueTask InvokeAsync(string identifier, object?[]? args) + { + Invocations.Add((identifier, args)); + return Result(Behavior(identifier, args)); + } - public ValueTask InvokeAsync(string identifier, CancellationToken cancellationToken, object?[]? args) => default; + private static async ValueTask Result(ValueTask call) + { + await call; + return default!; + } + + public ValueTask InvokeAsync(string identifier, CancellationToken cancellationToken, object?[]? args) + => InvokeAsync(identifier, args); } } From cabb2da90bee0b9ddc4bbf614d108b6425369969 Mon Sep 17 00:00:00 2001 From: Konstantin Dinev Date: Wed, 25 Nov 2026 14:45:06 +0200 Subject: [PATCH 3/6] test(dotnet 10, 11): addressing review --- .agents/skills/maintain-trim-compatibility/SKILL.md | 2 +- .agents/skills/write-library-tests/SKILL.md | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/igniteui-blazor-lite-release.yml | 2 +- .github/workflows/wasm-aot-smoke.yml | 12 ++++++++---- Directory.Packages.props | 7 +++++-- docs/TRIMMING.md | 2 +- .../IgniteUI.Blazor.Lite.IntegrationTests.csproj | 5 ++++- .../Infrastructure/TrimmedPublishServer.cs | 5 +++++ tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md | 2 +- .../IgniteUI.Blazor.Lite.TestBed.Client.csproj | 2 +- .../IgniteUI.Blazor.Lite.TestBed.csproj | 2 +- 12 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.agents/skills/maintain-trim-compatibility/SKILL.md b/.agents/skills/maintain-trim-compatibility/SKILL.md index fa155b58..ed30e8be 100644 --- a/.agents/skills/maintain-trim-compatibility/SKILL.md +++ b/.agents/skills/maintain-trim-compatibility/SKILL.md @@ -20,6 +20,6 @@ The library ships `IsTrimmable` + the AOT/single-file analyzers (`IsAotCompatibl ## Verification - `dotnet build src/IgniteUI.Blazor.Lite.csproj` must be free of IL diagnostics (they fail the build). -- For changes touching reflection, serialization, or annotations, run the automated browser checks over the trimmed publish: `dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings` (`TrimmedPublishSmokeTest`; publishes the smoke app net11.0 on demand). It is category-scoped — not part of the per-component integration sweep — and covers net11.0 only; the manual checklist in `tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md` covers the other TFMs. Trimming only happens at publish (`dotnet run` proves nothing). +- For changes touching reflection, serialization, or annotations, run the automated browser checks over the trimmed publish: `dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings` (`TrimmedPublishSmokeTest`; each TFM run serves the smoke app's publish output for its own TFM, publishing it on demand). It is category-scoped — not part of the per-component integration sweep. Trimming only happens at publish (`dotnet run` proves nothing). - Verify claims about linker behavior empirically in the smoke app — a control-vs-fix publish pair, not reasoning from documentation alone. - For AOT changes: `tests/IgniteUI.Blazor.Lite.AotSmoke` runs the RequiresDynamicCode-adjacent paths under real ILC (CI does this on linux-x64; locally `dotnet run --project tests/IgniteUI.Blazor.Lite.AotSmoke -c Release -p:SimulateNoDynamicCode=true` covers the interpreter paths without the native toolchain — see its README). diff --git a/.agents/skills/write-library-tests/SKILL.md b/.agents/skills/write-library-tests/SKILL.md index 275ca7a9..3d544f42 100644 --- a/.agents/skills/write-library-tests/SKILL.md +++ b/.agents/skills/write-library-tests/SKILL.md @@ -12,7 +12,7 @@ Three test projects under `tests/`, two suites: | Project | Suite | What it is | |---|---|---| | `IgniteUI.Blazor.Tests` | **Unit** | xUnit + bUnit, multi-targeted `net10.0`/`net11.0`; renders components in-process with a recording JS runtime — no browser | -| `IgniteUI.Blazor.Lite.IntegrationTests` | **Integration** | NUnit + Playwright; one generated test fixture per component | +| `IgniteUI.Blazor.Lite.IntegrationTests` | **Integration** | NUnit + Playwright; one generated test fixture per component; multi-targeted `net10.0`/`net11.0` (with the TestBed), the TFMs run one after another since the TestBed uses a fixed port | | `IgniteUI.Blazor.Lite.TestBed` | (integration host) | Blazor app the integration tests drive; renders one component per run and sweeps its surface | ## How the suites divide the work diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 562b2db1..c20e2d8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: - node-version: 22 + node-version: 26 cache: npm - name: Install npm dependencies diff --git a/.github/workflows/igniteui-blazor-lite-release.yml b/.github/workflows/igniteui-blazor-lite-release.yml index 7095b517..a38bc0b7 100644 --- a/.github/workflows/igniteui-blazor-lite-release.yml +++ b/.github/workflows/igniteui-blazor-lite-release.yml @@ -12,7 +12,7 @@ concurrency: env: BUILD_CONFIGURATION: Release DOTNET_VERSION: "11.0.x" - NODE_VERSION: "22" + NODE_VERSION: "26" VERSION: ${{ github.ref_name }} PACKAGE_ID: IgniteUI.Blazor.Lite PROJECT_PATH: src/IgniteUI.Blazor.Lite.csproj diff --git a/.github/workflows/wasm-aot-smoke.yml b/.github/workflows/wasm-aot-smoke.yml index 840ae38a..5a8f1b08 100644 --- a/.github/workflows/wasm-aot-smoke.yml +++ b/.github/workflows/wasm-aot-smoke.yml @@ -21,12 +21,14 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0 with: - dotnet-version: 11.0.x + dotnet-version: | + 10.0.x + 11.0.x - name: Setup Node.js uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: - node-version: 22 + node-version: 26 cache: npm - name: Install npm dependencies @@ -43,8 +45,10 @@ jobs: - name: Publish smoke app with AOT compilation run: dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net11.0 -p:TargetFrameworks=net11.0 -p:RunAOTCompilation=true + # The suite multi-targets; only its net11.0 run serves the AOT output published above + # (a net10.0 run would publish and test a non-AOT net10 build instead). - name: Build integration tests - run: dotnet build tests/IgniteUI.Blazor.Lite.IntegrationTests --configuration Release + run: dotnet build tests/IgniteUI.Blazor.Lite.IntegrationTests --configuration Release --framework net11.0 - name: Install Playwright shell: pwsh @@ -54,5 +58,5 @@ jobs: - name: Run browser checks against the AOT publish run: > dotnet test ./tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj - --settings ./.runsettings --no-build --configuration Release + --settings ./.runsettings --no-build --configuration Release --framework net11.0 --filter Category=TrimmedPublish diff --git a/Directory.Packages.props b/Directory.Packages.props index b4cdcdc1..f808103d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,8 +15,11 @@ - - + + + + + diff --git a/docs/TRIMMING.md b/docs/TRIMMING.md index bee406a7..07b197d2 100644 --- a/docs/TRIMMING.md +++ b/docs/TRIMMING.md @@ -61,7 +61,7 @@ AOT diagnostics (IL3xxx) build as errors like trim ones (`dotnet_analyzer_diagno ## Maintaining trim compatibility (contributors) -The library must stay trim-clean. Every trim-analysis diagnostic builds as an error (`dotnet_analyzer_diagnostic.category-Trimming.severity = error` in the repo `.editorconfig`; category bulk-config covers future IL2xxx codes, inert where the analyzer is off). The analyzer cannot validate suppression justifications or retention-based mechanisms like `[IgbModule]` — `tests/IgniteUI.Blazor.Lite.PublishSmoke` is the authoritative check for those, automated as the `TrimmedPublish`-category browser facts in `IgniteUI.Blazor.Lite.IntegrationTests` (net11.0, runs in CI); its README has the manual checklist covering the other TFMs. +The library must stay trim-clean. Every trim-analysis diagnostic builds as an error (`dotnet_analyzer_diagnostic.category-Trimming.severity = error` in the repo `.editorconfig`; category bulk-config covers future IL2xxx codes, inert where the analyzer is off). The analyzer cannot validate suppression justifications or retention-based mechanisms like `[IgbModule]` — `tests/IgniteUI.Blazor.Lite.PublishSmoke` is the authoritative check for those, automated as the `TrimmedPublish`-category browser facts in `IgniteUI.Blazor.Lite.IntegrationTests` (net10.0 and net11.0, runs in CI); its README has the manual checklist. When the analyzer flags new code, follow the standard playbook — avoid reflection and dynamic code where possible, otherwise annotate or fix the root cause, and suppress only as a last resort: see [preparing libraries for trimming: recommendations](https://learn.microsoft.com/dotnet/core/deploying/trimming/prepare-libraries-for-trimming#recommendations) and [resolving trim warnings](https://learn.microsoft.com/dotnet/core/deploying/trimming/fixing-warnings). Repo-specific rules on top: diff --git a/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj b/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj index 55646984..2ad920c1 100644 --- a/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj +++ b/tests/IgniteUI.Blazor.Lite.IntegrationTests/IgniteUI.Blazor.Lite.IntegrationTests.csproj @@ -1,7 +1,10 @@  - net11.0 + + net10.0;net11.0 + + false false true diff --git a/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs b/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs index a7eddcd2..d2c57730 100644 --- a/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs +++ b/tests/IgniteUI.Blazor.Lite.IntegrationTests/Infrastructure/TrimmedPublishServer.cs @@ -13,7 +13,12 @@ namespace IgniteUI.Blazor.Lite.IntegrationTests.Infrastructure /// internal sealed class TrimmedPublishServer : IAsyncDisposable { + // The PublishSmoke output for the TFM this run targets. +#if NET11_0_OR_GREATER private const string Tfm = "net11.0"; +#else + private const string Tfm = "net10.0"; +#endif private readonly WebApplication app; diff --git a/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md b/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md index 9061aaa3..cff65f1c 100644 --- a/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md +++ b/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md @@ -37,7 +37,7 @@ Three gates, in order of what they can see: | Chat message reads `Message: Hello from a trimmed app` | the Razor `MessageContent` renderer's output inside the chat | the renderer context lost its constructor — the library builds `IgbChatMessageRenderContext` itself and the app never does | | Browser console | no errors (a stray `favicon` 404 is fine) | anything else: investigate | -The checklist is automated as `TrimmedPublishSmokeTest` in `IgniteUI.Blazor.Lite.IntegrationTests` (`Category=TrimmedPublish`, runs in CI after the publish step). It serves the net11.0 publish output — publishing it on demand if missing — so locally it's just: +The checklist is automated as `TrimmedPublishSmokeTest` in `IgniteUI.Blazor.Lite.IntegrationTests` (`Category=TrimmedPublish`, runs in CI after the publish step). Each TFM run of the suite serves the publish output for its own TFM — publishing it on demand if missing — so locally it's just: ```bash dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings diff --git a/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj b/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj index 0369f596..b44773a3 100644 --- a/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj +++ b/tests/IgniteUI.Blazor.Lite.TestBed.Client/IgniteUI.Blazor.Lite.TestBed.Client.csproj @@ -1,7 +1,7 @@ - net11.0 + net10.0;net11.0 $(NoWarn);BL0016 diff --git a/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj b/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj index 194966e5..7aa30f14 100644 --- a/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj +++ b/tests/IgniteUI.Blazor.Lite.TestBed/IgniteUI.Blazor.Lite.TestBed.csproj @@ -1,7 +1,7 @@  - net11.0 + net10.0;net11.0 $(NoWarn);BL0016 From d6268d8bbc781fad3671cc4a5cbce2a6cbdf0361 Mon Sep 17 00:00:00 2001 From: Konstantin Dinev Date: Wed, 25 Nov 2026 14:57:38 +0200 Subject: [PATCH 4/6] Update comment for AOT workload to net11 Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/wasm-aot-smoke.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasm-aot-smoke.yml b/.github/workflows/wasm-aot-smoke.yml index 5a8f1b08..01923320 100644 --- a/.github/workflows/wasm-aot-smoke.yml +++ b/.github/workflows/wasm-aot-smoke.yml @@ -40,7 +40,7 @@ jobs: - name: Install wasm-tools workload run: dotnet workload install wasm-tools - # Restore ignores --framework, and restoring net10 with AOT on needs wasm-tools-net10. + # Restore ignores --framework, and restoring net11 with AOT on needs wasm-tools-net11. # TargetFrameworks limits restore to net11. - name: Publish smoke app with AOT compilation run: dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke --configuration Release --framework net11.0 -p:TargetFrameworks=net11.0 -p:RunAOTCompilation=true From 6a272c74018aa525e79413c39228b98f8c31e673 Mon Sep 17 00:00:00 2001 From: Konstantin Dinev Date: Wed, 25 Nov 2026 14:57:53 +0200 Subject: [PATCH 5/6] Update README.md for net11 AOT requirements Updated documentation to reflect changes in AOT requirements for net11. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md b/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md index cff65f1c..38ed83a9 100644 --- a/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md +++ b/tests/IgniteUI.Blazor.Lite.PublishSmoke/README.md @@ -55,7 +55,7 @@ dotnet publish tests/IgniteUI.Blazor.Lite.PublishSmoke -c Release -f net11.0 -p: dotnet test tests/IgniteUI.Blazor.Lite.IntegrationTests --filter Category=TrimmedPublish --settings .runsettings ``` -Restore ignores `-f`, and restoring net10 with AOT on needs `wasm-tools-net10`. `-p:TargetFrameworks=net11.0` limits restore to net11. +Restore ignores `-f`, and restoring net11 with AOT on needs `wasm-tools-net11`. `-p:TargetFrameworks=net11.0` limits restore to net11. Wasm AOT is Mono AOT with the interpreter retained — it validates the product path but emits no NativeAOT diagnostics; that gate is `tests/IgniteUI.Blazor.Lite.AotSmoke` (per-PR CI). From 1a3c00eecf55e6c403306c1b07dc13106451b42e Mon Sep 17 00:00:00 2001 From: Konstantin Dinev Date: Wed, 25 Nov 2026 14:58:17 +0200 Subject: [PATCH 6/6] Correct .NET version in threat model documentation Updated the .NET version referenced in the threat model section from .NET 11 to .NET 10. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- docs/security/threat-model.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/security/threat-model.md b/docs/security/threat-model.md index 58adcf1e..f271e8b4 100644 --- a/docs/security/threat-model.md +++ b/docs/security/threat-model.md @@ -98,7 +98,7 @@ Content the application renders *inside* a component is the application's own co | Bound data reaches the browser beyond what is displayed | Data-bound components serialize the **public properties and fields** of the bound item type, not only the members a template happens to render. The transfer happens once the component is interactive; static SSR and prerendered HTML carry no bound data ([§3](#3-trust-boundaries-by-hosting-model)). Narrow the type before binding; see *Bind projections, not entities* in [§5](#5-guidance-for-application-developers). | | Interop payloads appear in logs | The managed library logs no event arguments, renderer messages or bound values; it writes caught exceptions to the console. The browser bundle reports interop failures to the developer console, so a failing call can surface fragments of its payload there. | -Not a threat, recorded because [§3](#3-trust-boundaries-by-hosting-model) refers to it: the unmarshalled data channel depends on the .NET writer and the JavaScript reader agreeing on a fixed column layout. The channel passes the writer's data to the reader as a raw pointer into the WebAssembly heap. Unit tests drive the writer on every target framework through a test double; the real browser transport is exercised only on .NET 11 by the Playwright suite. In the other interactive models, and when the application opts for JSON, the same data travels as JSON. +Not a threat, recorded because [§3](#3-trust-boundaries-by-hosting-model) refers to it: the unmarshalled data channel depends on the .NET writer and the JavaScript reader agreeing on a fixed column layout. The channel passes the writer's data to the reader as a raw pointer into the WebAssembly heap. Unit tests drive the writer on every target framework through a test double; the real browser transport is exercised on .NET 10 and .NET 11 by the Playwright suite. In the other interactive models, and when the application opts for JSON, the same data travels as JSON ## 5. Guidance for application developers