Skip to content

Keep WebView modules fallback project-local - #68281

Open
PureWeen wants to merge 1 commit into
mainfrom
pureween-investigate-webview-fallback
Open

PureWeen wants to merge 1 commit into
mainfrom
pureween-investigate-webview-fallback

Conversation

@PureWeen

@PureWeen PureWeen commented Aug 7, 2026

Copy link
Copy Markdown
Member

Keep WebView modules fallback project-local

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a new feature or change, please open an issue to discuss the change or find an existing issue.

Keep the WebView modules fallback from flowing across project references.

Description

The conditional fallback introduced by #67375 and backported in #67401 correctly avoids colliding with an app-generated blazor.modules.json when a single consumer contributes JS modules. A remaining multi-project graph can still produce two fallbacks:

  1. An executable Razor app directly references Microsoft.AspNetCore.Components.WebView.
  2. A Razor class library also directly references the WebView package.
  3. The app references the RCL.
  4. Neither project contributes a JS module.

Both projects independently materialize the package's raw build/blazor.modules.json. Because the fallback was authored with AssetMode="All", the RCL asset flows across the project-reference boundary as SourceType=Project, SourceId=rcl. It then conflicts with the app's independently materialized SourceType=Discovered, SourceId=app asset at _framework/blazor.modules.json.

This changes the fallback to AssetMode="CurrentProject". That keeps the fallback available to each direct consumer while preventing a library-owned fallback from flowing into referencing projects. It matches the SDK's own build and publish JS-module manifests, which are also current-project-only. SDK conflict detection remains strict; the malformed duplicate is prevented at the package-authoring boundary rather than suppressed during aggregation.

The build-behavior coverage now includes the exact direct/direct no-module graph and a sibling graph where the directly-referencing RCL contributes a JS module. The consumer-build helper also omits an optional local package source when its directory does not exist and narrows network-failure detection so a missing local source cannot silently skip product assertions.

Validation

The exact new no-module assertion failed before the product change with:

Conflicting assets with the same target path '_framework/blazor.modules.json'

After changing the fallback to CurrentProject, the same assertion passes and publishes one empty [] manifest.

All five WebViewBuildBehaviorTests pass against current main, covering:

  • app plus RCL modules with a package reference;
  • app-only empty fallback;
  • app and RCL both directly referencing WebView with no modules;
  • app and RCL both directly referencing WebView with RCL modules;
  • WebView source-project/P2P consumption with RCL modules.

Related context: #67375, #67401, and dotnet/sdk#54779.

Prevent Razor class library fallbacks from flowing into referencing WebView apps and colliding with the app-owned modules manifest. Add direct-reference regression coverage and harden the consumer-build feed handling.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 4bdabca4-54b7-4e91-b94f-a51598a74d0f
@PureWeen
PureWeen marked this pull request as ready for review August 7, 2026 22:48
@PureWeen
PureWeen requested a review from a team as a code owner August 7, 2026 22:48
Copilot AI lite review requested due to automatic review settings August 7, 2026 22:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adjusts the WebView _framework/blazor.modules.json fallback static web asset so it remains available to each direct consumer project while preventing a library-owned fallback from flowing across ProjectReference boundaries and causing duplicate-asset conflicts during static web assets aggregation.

Changes:

  • Change the WebView modules fallback asset authoring from AssetMode="All" to AssetMode="CurrentProject" to prevent project-reference propagation.
  • Add end-to-end publish tests covering the direct app + direct RCL WebView-reference graphs (with and without RCL JS modules) to validate a single manifest is produced/served.
  • Make consumer test build infrastructure more robust by omitting a non-existent local package source and tightening “network failure” detection so missing local sources don’t cause silent skips.
Show a summary per file
File Description
src/Components/WebView/WebView/src/StaticWebAssets.Groups.targets Keeps the modules-manifest fallback scoped to the current project to avoid cross-project duplicate assets.
src/Components/WebView/test/StaticWebAssets/WebViewBuildBehaviorTests.cs Adds publish-behavior coverage for app+RCL graphs where both reference WebView, asserting exactly one served/published manifest.
src/Components/WebView/test/StaticWebAssets/ConsumerBuild.cs Improves hermetic consumer build setup by conditionally adding local feeds and refining network-failure skip detection.

Review details

Tip

Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

@PureWeen

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

@PureWeen
PureWeen marked this pull request as draft August 19, 2026 18:05
@PureWeen
PureWeen marked this pull request as ready for review August 19, 2026 18:17
@PureWeen

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

@PureWeen

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

@Youssef1313 Youssef1313 added the area-blazor Includes: Blazor, Razor Components label Sep 2, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Sep 26, 2026

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Current-head review — dfc711111e06e2cae20283c4f3d484b71d8a0b6b

No new high-confidence actionable finding identified. I inspected the full fallback target, consumer-build helper, both new app/RCL graphs, and the existing manifest lookup/assertion helpers. AssetMode="CurrentProject" scopes the empty fallback rather than changing the generated-module condition or route; the two new cases distinguish an empty fallback from an RCL-generated module list. Optional nonshipping-feed handling and the narrower network classification do not turn a missing local feed into a network skip.

Prior feedback: The existing review contains no concrete finding. All review/inline/issue-comment surfaces were considered; the historical /azp run requests and inactivity notice do not prove a fresh consumer build.

Validation and limits: Target XML parsing and frozen git diff --check pass. No local package pack, SDK consumer publish, real WebView, or app/RCL runtime run was performed. The harness requires repository-built packages and its repository-local SDK; I did not bootstrap that graph. Source inspection is not empirical proof of the SDK's asset propagation. The tests also return early on recognized network failures, so a green aggregate alone cannot prove their route/content assertions executed. Head CI, template, Components E2E, and Build Analysis report success; neutral/skipped jobs are not additional validation.

Scope: GPT-6.1 Sol; no model campaign, native-device execution, visual/browser validation, approval, or merge-readiness claim.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agentic-workflows area-blazor Includes: Blazor, Razor Components pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants