Skip to content
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

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

Closed
seclerp opened this issue Jul 4, 2023 · 4 comments · Fixed by #88919
Assignees
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Milestone

Comments

@seclerp
Copy link

seclerp commented Jul 4, 2023

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>
@ghost ghost added the untriaged New issue has not been triaged by the area owner label Jul 4, 2023
@ghost
Copy link

ghost commented Jul 4, 2023

Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov
See info in area-owners.md if you want to be subscribed.

Issue Details

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>
Author: seclerp
Assignees: -
Labels:

area-Host

Milestone: -

@seclerp seclerp 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 Jul 4, 2023
@radical radical added the arch-wasm WebAssembly architecture label Jul 6, 2023
@ghost
Copy link

ghost commented Jul 6, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

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>
Author: seclerp
Assignees: -
Labels:

arch-wasm, area-Host, untriaged

Milestone: -

@radical radical added this to the 8.0.0 milestone Jul 6, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Jul 6, 2023
@radical
Copy link
Member

radical commented Jul 6, 2023

cc @ilonatommy @thaystg

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 14, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 17, 2023
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 17, 2023
@seclerp
Copy link
Author

seclerp commented Jul 17, 2023

Thanks!

@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Aug 3, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Aug 14, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Sep 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-Debugger-mono
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants