Skip to content

.NET 8 RC1 Blazor Web App: [RenderModeAuto] keeps using the Server implementation then switches to WASM #50677

@dmm-l-mediehus

Description

@dmm-l-mediehus

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

I have a simple Weather app that consists of 3 projects:

  • BlazorApp1 (server and API controller for the client)
  • BlazorApp1.Client (client)
  • ClassLibrary1 (shared lib)

Class Library holds interfaces, and service-implementations.

  • In BlazorApp1, I inject the IWeatherService to use WeatherService.cs
  • In BlazorApp1.Client, I inject the IWeatherService to use HttpClientWeatherService.cs

in Weather.razor (BlazorApp1.Client.Components.Weather.razor), I inject IWeatherService and use GetForecastsAsync()-method to get forecasts.

I noticed the app keeps using Server implementation (WeatherService.cs) at first (both navigating from /counter back to weather and F5 refresh) then switches to WASM implementation (HttpClientWeatherService.cs), even though the app is finished downloaded in the background.

Expected Behavior

I expect the Web App to only use the WASM implementation of the service, when the application is downloaded and cached.

Steps To Reproduce

  1. Clone https://github.com/dmm-l-mediehus/BlazorApp1-RenderModeIssue
  2. Run the app with debugging (F5)
  3. Set breakpoints at the HttpClientWeatherService.cs line 19, and WeatherService.cs line 22
  4. Navigate to /weather and the breakpoint will hit Server at first which is fine initially. But when navigating to another page, and back to /weather - it should hit the WASM breakpoint, but doesn't. Same for F5 - it should use the HttpClientWeatherService.cs implementation

Exceptions (if any)

No response

.NET Version

8.0.100-rc.1.23455.8

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Components

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions