Skip to content

Blazor WASM: BrowserDebugHost.dll running from DevServer is missing roll-forward runtime policy #88391

Closed

Description

@seclerp

Description

When the default standalone Blazor WebAssembly project is starting, it's hosted using DevServer. Then, DevServer starts framework-dependent BrowserDebugHost.dll when it receives /debug/ws-proxy?... request. But, unlike DevServer itself, BrowserDebugHost.dll is missing configuration to roll forward on available runtime versions. This leads to situations when the user is able to start the application itself using dotnet run, but DevServer runs BrowserDebugHost using dotnet exec, which requires a specific runtime version by default.

Reproduction Steps

  1. Uninstall .NET 6 SDK (if installed)
  2. Install .NET 7 SDK or .NET 8 SDK
  3. dotnet new blazorwasm -n TestApp1
  4. Open the newly created project in VS Code
  5. Change TFM from net7.0 to net6.0
  6. Change NuGet versions from 7.0.8 to 6.0.19
  7. dotnet build
  8. Run the project with debugging enabled ("Launch and Debug Standalone WebAssembly App")

A preconfigured project can be found here.

Expected behavior

The app is running correctly, debugging is completely working as usual.

Actual behavior

The app starts, but debugging is completely broken, with a lot of exceptions in the console.

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
      System.InvalidOperationException: No output has been recevied from the application.
         at Microsoft.AspNetCore.Builder.DebugProxyLauncher.LaunchAndGetUrl(IServiceProvider serviceProvider, String devToolsHost)
         at Microsoft.AspNetCore.Builder.WebAssemblyNetDebugProxyAppBuilderExtensions.<>c.<<UseWebAssemblyDebugging>b__0_1>d.MoveNext()
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

Regression?

No response

Known Workarounds

Since we can't control the process creation process for BrowserDebugHost.dll in DevServer, the only available option is to set the environment variable for DevServer and let it propagate to a child process with BrowserDebugHost.dll.

So DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX =2 or DOTNET_ROLL_FORWARD=Major should be used.

Options are from here.

Configuration

.NET SDK:
 Version:   8.0.100-preview.5.23303.2
 Commit:    3fe444af72

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  13.4
 OS Platform: Darwin
 RID:         osx.13-arm64
 Base Path:   /usr/local/share/dotnet/sdk/8.0.100-preview.5.23303.2/

.NET workloads installed:
 [maui]
   Installation Source: SDK 8.0.100-preview.5
   Manifest Version:    8.0.0-preview.5.8529/8.0.100-preview.5
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.5/microsoft.net.sdk.maui/WorkloadManifest.json
   Install Type:        FileBased
 [wasm-tools-net7]
   Installation Source: SDK 8.0.100-preview.5
   Manifest Version:    8.0.0-preview.5.23280.8/8.0.100-preview.5
   Manifest Path:       /usr/local/share/dotnet/sdk-manifests/8.0.100-preview.5/microsoft.net.workload.mono.toolchain.net7/WorkloadManifest.json
   Install Type:        FileBased

Host:
  Version:      8.0.0-preview.5.23280.8
  Architecture: arm64
  Commit:       bc78804f5d

.NET SDKs installed:
  7.0.203 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.4.23260.5 [/usr/local/share/dotnet/sdk]
  8.0.100-preview.5.23303.2 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.4.23260.4 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0-preview.5.23302.2 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.4.23259.5 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0-preview.5.23280.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
  x64   [/usr/local/share/dotnet/x64]
    registered at [/etc/dotnet/install_location_x64]

Other information

A possible fix for such an issue is to add runtimeconfig.template.json for the BrowserDebugHost project itself, with a pre-configured roll-forward policy:

{
  "tfm": "net7.0",
  "rollForward": "Major"
}

Or using a project file:

<PropertyGroup>
  <RollForward>Major</RollForward>
</PropertyGroup>

Activity

  1. ghost added
    untriaged
    on Jul 4, 2023
  2. changed the title [-]BrowserDebugHost.dll running from DevServer is missing roll-forward runtime policy[/-] [+]Blazor WASM: BrowserDebugHost.dll running from DevServer is missing roll-forward runtime policy[/+] on Jul 4, 2023
  3. added
    arch-wasm
    on Jul 6, 2023
  4. added this to the 8.0.0 milestone on Jul 6, 2023
  5. ghost removed
    untriaged
    on Jul 6, 2023
  6. radical commented on Jul 6, 2023

    @radical
    Member
  7. ghost added
    in-pr
    on Jul 14, 2023
  8. ghost removed
    in-pr
    on Jul 17, 2023
  9. ghost added
    in-pr
    on Jul 17, 2023
  10. seclerp commented on Jul 17, 2023

    @seclerp
    Author

    Thanks!

  11. ghost removed
    in-pr
    on Aug 3, 2023
  12. ghost added
    in-pr
    on Aug 3, 2023
  13. ghost removed
    in-pr
    on Aug 14, 2023
  14. ghost locked as resolved and limited conversation to collaborators on Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

arch-wasmarea-Debugger-mono

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions