Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The PR description claims all projects were upgraded to .NET 10 but at least one solution-included project remains on net8.0, and there is also a confirmed interop disposal best-practice issue surfaced in the touched Blazor component.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR modernizes the KITT.Web.ReCaptcha library, tests, and sample applications by moving the solution to .NET 10, updating NuGet dependencies, and aligning the Blazor samples with newer static asset patterns (including adoption of the .slnx solution format).
Changes:
- Upgrade library, test, and sample projects to
net10.0and refresh NuGet package versions (including a major version bump to2.0.0for the shipped packages). - Update Blazor samples to use
app.MapStaticAssets()and the@Assets[...]helper for static asset references. - Refactor parts of the API surface to newer C# patterns (e.g., primary constructors) and update tests for newer bUnit/JSInterop APIs.
File summaries
| File | Description |
|---|---|
| tests/KITT.Web.ReCaptcha.Http.Test/KITT.Web.ReCaptcha.Http.Test.csproj | Targets .NET 10 and updates test/dependency packages. |
| tests/KITT.Web.ReCaptcha.Blazor.Test/KITT.Web.ReCaptcha.Blazor.Test.csproj | Targets .NET 10 and updates bUnit/xUnit tooling packages. |
| tests/KITT.Web.ReCaptcha.Blazor.Test/v3/ReCaptchaServiceTest.cs | Updates bUnit test base type usage for v3 tests. |
| tests/KITT.Web.ReCaptcha.Blazor.Test/v3/ReCaptchaScriptTest.razor | Updates test context inheritance to match new bUnit context type. |
| tests/KITT.Web.ReCaptcha.Blazor.Test/v2/ReCaptchaTest.razor | Updates bUnit context creation and JSInterop expectations for void interop calls. |
| src/KITT.Web.ReCaptcha.Http/KITT.Web.ReCaptcha.Http.csproj | Moves library to net10.0 only, updates package refs, bumps version to 2.0.0. |
| src/KITT.Web.ReCaptcha.Http/v2/ReCaptchaService.cs | Switches to primary-constructor style to align with newer C#/.NET patterns. |
| src/KITT.Web.ReCaptcha.Http/v3/ReCaptchaService.cs | Switches to primary-constructor style to align with newer C#/.NET patterns. |
| src/KITT.Web.ReCaptcha.Http/v3/ReCaptchaResponse.cs | Uses a modern empty collection expression for ErrorCodes. |
| src/KITT.Web.ReCaptcha.Blazor/KITT.Web.ReCaptcha.Blazor.csproj | Targets .NET 10, updates Blazor package refs, bumps version to 2.0.0. |
| src/KITT.Web.ReCaptcha.Blazor/v2/ReCaptcha.razor.cs | Updates JS interop usage and refactors JS runtime injection pattern. |
| samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor/Program.cs | Switches sample static-file handling to MapStaticAssets(). |
| samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor/Components/App.razor | Moves static asset references to @Assets[...]. |
| samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor.csproj | Targets .NET 10 and updates WASM server package versions. |
| samples/v2/KITT.Web.ReCaptcha.Samples.v2.Blazor/KITT.Web.ReCaptcha.Samples.v2.Blazor.Client/KITT.Web.ReCaptcha.Samples.v2.Blazor.Client.csproj | Targets .NET 10 and updates WebAssembly/Http package versions. |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor/Program.cs | Switches sample static-file handling to MapStaticAssets(). |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor/Components/App.razor | Moves static asset references to @Assets[...]. |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor.csproj | Targets .NET 10 and updates WASM server package versions. |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.Blazor/KITT.Web.ReCaptcha.Samples.v3.Blazor.Client/KITT.Web.ReCaptcha.Samples.v3.Blazor.Client.csproj | Targets .NET 10 and updates WebAssembly/Http package versions. |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity/Program.cs | Switches sample static-file handling to MapStaticAssets(). |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity/Components/App.razor | Moves static asset references to @Assets[...]. |
| samples/v3/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity/KITT.Web.ReCaptcha.Samples.v3.BlazorServerInteractivity.csproj | Targets .NET 10 for the server interactivity sample. |
| KITT.Web.ReCaptcha.slnx | Introduces new .slnx solution structure with organized folders/projects. |
| KITT.Web.ReCaptcha.sln | Removes legacy .sln in favor of .slnx. |
Review details
Suppressed comments (1)
src/KITT.Web.ReCaptcha.Blazor/v2/ReCaptcha.razor.cs:81
DotNetObjectReference.Create(this)creates anIDisposablereference that should be disposed when the component is disposed; otherwise it can leak and keep the component alive longer than intended. Consider storing the reference in a field (e.g.,_dotNetRef) and disposing it inDisposeAsyncalongside the JS module.
await module.InvokeVoidAsync(
"initialize",
DotNetObjectReference.Create(this),
Id,
SiteKey,
- Files reviewed: 24/24 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This pull request introduces significant updates to modernize the solution and sample projects for the KITT.Web.ReCaptcha library. The main changes include upgrading all projects to .NET 10, updating NuGet dependencies to their latest versions, refactoring asset management to use the new
@Assetshelper, and updating the Blazor component structure to align with the latest best practices. Additionally, the solution file has been migrated to the new.slnxformat.Project and Dependency Upgrades:
.csprojfiles) now target.NET 10.0instead of.NET 8.0, and all Microsoft package references have been updated to version10.0.11where applicable. The main library version is also bumped to2.0.0. [1] [2] [3] [4] [5] [6] [7]Asset Management and Static Files:
@Assetshelper for referencing static assets (CSS, JS), replacing hard-coded paths for improved compatibility with .NET 10's static asset handling. [1] [2] [3]app.MapStaticAssets()instead ofapp.UseStaticFiles(), reflecting .NET 10's updated approach to serving static files in Blazor projects. [1] [2] [3]Solution Structure Modernization:
.slnsolution file has been replaced with a new.slnxsolution file, which organizes projects and folders in a modern, cross-platform compatible format. [1] [2]Blazor Component Refactoring:
ReCaptchav2 component inKITT.Web.ReCaptcha.Blazornow receives itsIJSRuntimedependency via constructor injection rather than property injection, and JS interop calls have been updated to use the new pattern. [1] [2]These changes ensure the codebase is up-to-date with the latest .NET and Blazor features, improve maintainability, and future-proof the project for upcoming releases.