Skip to content

Fix Blazor WASM SWA test failures#53808

Open
javiercn wants to merge 1 commit intomainfrom
javiercn/fix-unskipped-tests
Open

Fix Blazor WASM SWA test failures#53808
javiercn wants to merge 1 commit intomainfrom
javiercn/fix-unskipped-tests

Conversation

@javiercn
Copy link
Copy Markdown
Member

Fixes #53791

This PR fixes all static web assets related Blazor WASM test failures:

  • Removed Skip attributes from 13 tests across BlazorWasmStaticWebAssetsIntegrationTest, WasmJsModulesIntegrationTests, and WasmPublishIntegrationTest
  • Fixed BlazorWasmReferencedByAspNetCoreServer test asset — replaced hardcoded net11.0 TFM and stale 10.0.0-rc.1.25451.107 package versions with $(AspNetTestTfm) / Version="5.0.0", and simplified Client/Server code to use 5.0-compatible APIs
  • Fixed Publish_WithTrimmingdDisabled_WorksMicrosoft.Extensions.Logging.Abstractions.wasm no longer exists in .NET 11 (merged into Microsoft.Extensions.Logging); updated the assertion accordingly
  • Regenerated stale baselines for compressed asset changes in .NET 11

@javiercn javiercn requested a review from a team as a code owner April 10, 2026 13:52
Copilot AI review requested due to automatic review settings April 10, 2026 13:52
@github-actions github-actions bot added the Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK label Apr 10, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Thanks for your PR, @@javiercn.
To learn about the PR process and branching schedule of this repo, please take a look at the SDK PR Guide.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Blazor WebAssembly static web assets test failures by updating test assets and expectations to match current framework packaging/output, and by re-enabling previously skipped tests once baselines are refreshed.

Changes:

  • Re-enabled multiple previously skipped Blazor WASM SWA tests gated by MSBuild version requirements.
  • Updated the BlazorWasmReferencedByAspNetCoreServer test asset to use $(AspNetTestTfm) and refreshed ASP.NET Core package references + hosting code paths.
  • Regenerated/updated static web assets baselines to reflect current compressed asset/assembly outputs (including removed/merged assemblies).

Reviewed changes

Copilot reviewed 19 out of 31 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/Server/Server.csproj Switches to $(AspNetTestTfm) and updates package references for the server test asset.
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/Server/Program.cs Simplifies middleware setup to a compatible hosted WASM static file pattern.
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/Client/Program.cs Simplifies client entry point for the test asset.
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/Client/Client.csproj Switches to $(AspNetTestTfm) and refreshes WebAssembly package references.
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/Client/App.razor Removes FocusOnNavigate to align with older-compatible client template surface.
test/TestAssets/TestProjects/BlazorWasmReferencedByAspNetCoreServer/Client/_Imports.razor Removes unused/older imports not needed by the simplified test asset.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmPublishIntegrationTest.cs Unskips MSBuild-gated publish tests and updates assertion for merged logging assembly output.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/WasmJsModulesIntegrationTests.cs Unskips MSBuild-gated JS module tests.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_PublishMinimal_Works.Publish.files.json Updates expected publish file list to match current framework assembly set and compression outputs.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Publish_Hosted_Works.Publish.files.json Updates hosted publish file baseline for current assembly/compression outputs.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Publish_DoesNotIncludeXmlDocumentationFiles_AsAssets.Publish.files.json Updates publish baseline for current assembly/compression outputs while validating XML docs exclusion.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_HostedApp_ReferencingNetStandardLibrary_Works.Build.staticwebassets.json Refreshes SWA manifest baseline (including AssetGroups field emission).
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_BuildMinimal_Works.Build.files.json Updates build baseline for minimal app to match current compressed/webcil outputs.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_Build_Hosted_Works.Build.files.json Updates build baseline for hosted app to match current compressed outputs.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/StaticWebAssets_BackCompatibilityPublish_Hosted_Works.Publish.staticwebassets.json Updates back-compat publish SWA manifest baseline (including AssetGroups).
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/Publish_DoesNotGenerateManifestJson_IncludesJSModulesOnBlazorBootJsonManifest.Publish.files.json Updates JS-modules publish baseline to match current output set.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_Hosted_CanCustomizeBlazorInitialization.Publish.files.json Updates hosted JS modules publish baseline for current output set.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_CanHaveDifferentBuildAndPublishModules.Publish.files.json Updates JS modules publish baseline for current output set.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/StaticWebAssetsBaselines/JsModules_CanCustomizeBlazorInitialization.Publish.files.json Updates JS modules publish baseline for current output set.
test/Microsoft.NET.Sdk.BlazorWebAssembly.Tests/BlazorWasmStaticWebAssetsIntegrationTest.cs Unskips MSBuild-gated static web assets integration tests.

Comment on lines 1 to 2
using System;

Copy link

Copilot AI Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using System; appears unused in this file and can trigger CS8019 (unnecessary using directive). Please remove it to keep the test asset warning-clean.

Suggested change
using System;

Copilot uses AI. Check for mistakes.
- Remove Skip attributes from 13 tests
- Fix BlazorWasmReferencedByAspNetCoreServer test asset: use  and  instead of hardcoded net11.0/10.0.0-rc.1.25451.107
- Remove builder.Services.AddScoped call that hits CS0012 (DI Abstractions merged into DI in preview.4)
- Fix Publish_WithTrimmingdDisabled_Works: check Microsoft.Extensions.Logging.wasm instead of Abstractions (merged in .NET 11)
- Regenerate stale baselines for compressed asset changes
@javiercn javiercn force-pushed the javiercn/fix-unskipped-tests branch from 199e36f to e483b50 Compare April 10, 2026 14:07
@javiercn javiercn enabled auto-merge (squash) April 10, 2026 18:22
@javiercn javiercn requested review from lewing and maraf April 11, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-AspNetCore RazorSDK, BlazorWebAssemblySDK, StaticWebAssetsSDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Blazor test failures

2 participants