Skip to content

Feat: default StaticWebAssetsRuntimeFileProvider for BlazorWebView #248

Merged
AnnaSasDev merged 7 commits intocorefrom
fixBlazorWebView
Apr 22, 2026
Merged

Feat: default StaticWebAssetsRuntimeFileProvider for BlazorWebView #248
AnnaSasDev merged 7 commits intocorefrom
fixBlazorWebView

Conversation

@AnnaSasDev
Copy link
Copy Markdown
Member

Summary

This PR fixes BlazorWebView resource/module loading and trims/AOT compatibility regressions introduced around static web assets resolution and host messaging.

It standardizes BlazorWebView internal origin handling to app://localhost, improves static web assets manifest selection/loading, suppresses noisy Blazor internal __bwv: message warnings in InfiniFrame.js, and updates docs to match runtime behavior.

Type of Change

  • Bug fix (non-breaking change fixing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature impacting existing APIs)
  • Documentation update
  • Test addition or update

Affected Modules / Scope

  • InfiniFrame.BlazorWebView
  • InfiniFrame.Js
  • InfiniFrame.Native
  • InfiniFrameExample
  • InfiniFrameTests
  • Other: docs

Changes Introduced

  • Standardized BlazorWebView app base/scheme behavior to app://localhost and aligned request handling/content-type fallback for module/static asset responses.
  • Improved static web assets runtime manifest discovery/selection and made manifest JSON deserialization trim/AOT-safe using source-generated System.Text.Json context.
  • Updated host JS messaging to ignore Blazor internal __bwv: messages (no false “No handler registered” warnings), added regression tests, and updated BlazorWebView/migration docs to reflect current internal origin behavior.

Related Issues

Checklist

  • My code follows InfiniFrame's coding conventions
  • I added comments for complex or non-obvious code
  • Documentation updated (if applicable)
  • All tests pass locally
  • Added new tests for any new functionality
  • Existing tests pass
  • No new warnings or errors introduced
  • PR only includes changes relevant to the issue / feature

… asset management and update BlazorWebView architecture

- Added `StaticWebAssetsRuntimeFileProvider` to support runtime static web asset resolution with composite and physical file providers.
- Updated file provider configuration in `InfiniFrameBlazorAppBuilder` to improve web asset management.
- Removed redundant `wwwroot` configurations from project files.
- Added `InternalsVisibleTo` for test projects and introduced unit tests for `StaticWebAssetsRuntimeFileProvider`.
- Enhanced solution structure with new project references and test cases.
…prove fallback content type handling

- Unified `BlazorAppScheme` to use `app://localhost/` across all platforms, removing OS-specific logic.
- Added `GetFallbackContentType` method for improved MIME type resolution.
- Updated documentation to reflect changes to the internal origin scheme.
- Minor code cleanup and file provider reordering in `InfiniFrameBlazorAppBuilder`.
- Annotated static web asset types with `[UsedImplicitly]` to suppress inspection warnings.
…nd reorganize `StaticWebAssetsRuntimeFileProvider` internals

- Moved `StaticWebAsset`, `StaticWebAssetPattern`, `NodeTraversalState`, `ManifestCandidate`, and related classes to separate files under `FileProviders.Static`.
- Updated namespace references in affected files and tests for consistency.
- Improved maintainability of `StaticWebAssetsRuntimeFileProvider` by restructuring internal implementations.
…setManifest` deserialization

- Introduced `StaticWebAssetsManifestJsonContext` using `JsonSerializerContext` for optimized deserialization.
- Replaced manual `JsonSerializerOptions` with source-generated context in `StaticWebAssetsRuntimeFileProvider`.
Copy link
Copy Markdown
Contributor

@github-advanced-security github-advanced-security AI left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

…dling

- Enhanced WebView2 initialization on Windows to validate custom scheme registration support.
- Added fallback error messaging for unsupported WebView2 runtime.
- Updated StaticWebAssets to use `ConcurrentDictionary` for thread safety and added deterministic tie-breaking for manifest scoring.
- Expanded unit tests for `StaticWebAssetsRuntimeFileProvider` to ensure stability and correctness under concurrent access.
- Updated documentation to reflect platform-specific notes for BlazorWebView initialization.
@AnnaSasDev AnnaSasDev merged commit 4db3797 into core Apr 22, 2026
27 checks passed
@AnnaSasDev AnnaSasDev deleted the fixBlazorWebView branch April 22, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants