Skip to content

Fix Blazor WASM compatibility by replacing FrameworkReference with PackageReferences #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 3, 2025

Problem

Version 2.0.3+ of Serilog.Enrichers.ClientInfo causes build failures in Blazor WebAssembly applications with the error:

error NETSDK1082: There was no runtime pack for Microsoft.AspNetCore.App available for the specified RuntimeIdentifier 'browser-wasm'.

This occurs because Blazor WASM apps run in the browser and cannot reference the full Microsoft.AspNetCore.App framework that was added unconditionally in commit e0fa4cb.

Root Cause

The library includes:

<FrameworkReference Include="Microsoft.AspNetCore.App" />

This framework reference is incompatible with the browser-wasm runtime identifier used by Blazor WebAssembly applications, but the library only actually needs specific HTTP abstractions, not the entire ASP.NET Core framework.

Solution

Replaced the problematic FrameworkReference with specific PackageReference entries:

<ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
    <PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
</ItemGroup>

This provides exactly what the enrichers need:

  • IHttpContextAccessor interface from Microsoft.AspNetCore.Http.Abstractions
  • HttpContextAccessor implementation from Microsoft.AspNetCore.Http

Testing

  • ✅ All existing tests pass (19/19)
  • ✅ Sample web app works correctly
  • ✅ Blazor WASM test project builds successfully with enrichers configured
  • ✅ No breaking changes to existing functionality

The fix is minimal and surgical, maintaining full backward compatibility while resolving the browser-wasm compatibility issue.

Fixes #33.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits July 3, 2025 18:02
Co-authored-by: mo-esmp <1659032+mo-esmp@users.noreply.github.com>
…ckageReferences

Co-authored-by: mo-esmp <1659032+mo-esmp@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 2.0.3 no longer working with Blazor WASM Fix Blazor WASM compatibility by replacing FrameworkReference with PackageReferences Jul 3, 2025
@Copilot Copilot AI requested a review from mo-esmp July 3, 2025 18:08
Copilot finished work on behalf of mo-esmp July 3, 2025 18:08
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.0.3 no longer working with Blazor WASM
2 participants