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

[BUG] A valid browser not found when debugging from local DevContainer #742

Open
FBoucher opened this issue Nov 21, 2023 · 15 comments
Open
Assignees
Labels
area-razor bug Something isn't working
Milestone

Comments

@FBoucher
Copy link

FBoucher commented Nov 21, 2023

Describe the Issue

Debugging a web app in local DevContainer gives errors and does not allow for debugging.

image

I had the same experience on a Windows 11 and Ubuntu 22.04.
It works fine when running locally (Edge is installed).
When I re-open in a devContainer I have the same "A valid browser is not installed." message.

Steps To Reproduce

  1. Create a new blazor wasm
  2. reopen in a DEvContainer

devcontainer.json

{
    "name": "C# (.NET) and MySQL",
    "dockerComposeFile": "docker-compose.yml",
    "service": "devbox",
    "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}"
	, "customizations": {
		"vscode": {
			"extensions": [
				"ms-dotnettools.csharp",
				"ms-dotnettools.csdevkit",
				"ms-dotnettools.blazorwasm-companion",
				"eamodio.gitlens"
			]
		}
	}
	, "forwardPorts": [5000, 5001, 3306]
	, "portsAttributes": {
			"5001": {
				"protocol": "https"
			}
	}
	, "remoteUser": "root"
}

dockerfile

FROM mcr.microsoft.com/devcontainers/dotnet:8.0

Expected Behavior

Debug launches with the app opening in the browser

Environment Information

  • OS: Windows 11 and Ubuntu 22.04
  • x64
  • dotnet --version 8.0.100
  • Extension
    • C# DevKit v1.0.4
    • C# v2.3.27
@FBoucher FBoucher added the bug Something isn't working label Nov 21, 2023
@microsoft-issue-labeler microsoft-issue-labeler bot added the area-test Test discovery, execution, debugging label Nov 21, 2023
@timheuer
Copy link
Member

@FBoucher I don't think this is a dev kit issue, but rather needing dependencies in the devcontainer you are building to satisfy the scenarios.

@timheuer timheuer added area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire and removed area-test Test discovery, execution, debugging labels Nov 22, 2023
@timheuer
Copy link
Member

@WardenGnaw I'm not sure if these errors are coming from vsdbg or the companion. In 'normal' web debug even in a devcontainer int launches the host browser and tunnels. In wasm, it seems that assumption is not made?

Repro project: https://github.com/timheuer/csdevkit-742

@WardenGnaw
Copy link
Member

@timheuer This error is from the C# Extension. Specifically https://github.com/dotnet/vscode-csharp/blob/e5c352d80af74199b832404cfe2b8e93809e84bf/src/razor/src/blazorDebug/blazorDebugConfigurationProvider.ts#L182

@phil-allen-msft Does Blazor Debugging work with dev containers?

@FBoucher
Copy link
Author

Oh! I didn't realize it could be that! Looking forward knowing if WASM is supported

@FBoucher
Copy link
Author

@phil-allen-msft is it supported?

@phil-allen-msft phil-allen-msft self-assigned this Feb 1, 2024
@MSFTJim
Copy link

MSFTJim commented Mar 19, 2024

I am also getting these error messages. I get them when I try to use the C# DevKit and debug on a Blazor project that includes wasm (wasm or auto). If the project does not include wasm, then the devkit debug works fine. If the project does include wasm, I discovered I could just create the launch and task entries and then I can debug. I was doing this with Codespaces.

Not sure if this helps but thought I would share.

Copy link

github-actions bot commented Apr 3, 2024

This issue has been marked as stale after 14 days of inactivity. @[ @phil-allen-msft @], could you please take a look?

@WardenGnaw WardenGnaw removed the area-dotnet-debugging Issues around .NET Debugging with console, ASP.NET, or Aspire label Apr 29, 2024
@phil-allen-msft phil-allen-msft added this to the July2024 milestone May 7, 2024
@phil-allen-msft phil-allen-msft modified the milestones: July2024, Nov2024 Oct 1, 2024
@WellspringCS
Copy link

I see these errors, too, basically the same setup. Dev container, blazor.

@dkwgit
Copy link

dkwgit commented Oct 22, 2024

Not sure whom to ask, perhaps @phil-allen-msft , but it would be good to have confirmed if this is currently not working, since that would save the trouble of trying to make it work.

@FBoucher
Copy link
Author

Let me know if I can help validating or something. Happy to help.

@ryzngard ryzngard modified the milestones: Nov2024, Dec2024 Dec 6, 2024
@clarity99
Copy link

I get this on a macos host, blazor server project.

@macel94
Copy link

macel94 commented Jan 9, 2025

We hit this issue because we wanted to finally use blazor for something.
This is really a stopper.

@serefarikan
Copy link

My case is using a devcontainer over SSH and I'm hitting the same problem. I ssh into WSL, then start a devcontainer and attempting to debug blazor ends up with this error displayed by vs code. It sounds like SSH is not the factor here, vs code extension is simply not aware of the container context.

@macel94
Copy link

macel94 commented Jan 9, 2025

Caution

If you do not want to lose time as i did, do not try to continue with this.

If you install edge as i did both in wsl and in my devcontainer

## Edge Setup - needed for wasm debugging
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /usr/share/keyrings/
sudo sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-beta.list'
sudo rm microsoft.gpg

## Install
sudo apt update
sudo apt install microsoft-edge-beta

then you can launch the debugger, but you will fail anyway.
This is because debugging is not officially supported in wsl or devcontainers:
https://learn.microsoft.com/en-us/aspnet/core/blazor/debug?view=aspnetcore-9.0&tabs=visual-studio-code

Available scenarios for Blazor WebAssembly debugging include:

Set and remove breakpoints.
Run the app with debugging support in IDEs.
Single-step through the code.
Resume code execution with a keyboard shortcut in IDEs.
In the Locals window, observe the values of local variables.
See the call stack, including call chains between JavaScript and .NET.
Use a symbol server for debugging, configured by Visual Studio preferences.
Unsupported scenarios include:

Debug in non-local scenarios (for example, Windows Subsystem for Linux (WSL) or Visual Studio Codespaces).
Debug in Firefox from Visual Studio or Visual Studio Code.

also:

Start Without Debugging [Ctrl+F5 (Windows) or ⌘+F5 (macOS)] isn't supported. When the app is run in Debug configuration, debugging overhead always results in a small performance reduction.

@serefarikan
Copy link

@macel94 you're right about debugging not being supported. However, vs code does a great job of launching a local (as in on the machine running vs code) browser and redirecting the ports in many cases. Installing a browser in WSL or the container is a workaround, but still significantly inferior to convenience vs code provides in other cases.

@webreidi webreidi removed this from the Dec2024 milestone Jan 24, 2025
@webreidi webreidi added this to the Feb2025 milestone Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-razor bug Something isn't working
Projects
None yet
Development

No branches or pull requests