Bug Description
The incorrect launch configuration is populated for hosted Blazor apps.
Steps to Reproduce
dotnet new blazorwasm --hosted -o hosted.${workspaceFolder}/Server.
The actual debugging of hosted apps still works if you edit the pre-generated launch configuration to have the right contents.
It appears that this bug has been around for quite a while.
A few days back @NTaylorMullen and I were doing some investigation into a broken launch configuration from a hosted project in an earlier version of Omnisharp. The launch config that was created didn't look correct, it was basically the launch config for a standalone web project but located within a server directory.
Now I realize that the logic within Omnisharp that determines whether a Blazor WASM project is hosted or standalone is a little wonky. It ends up categorizing all hosted projects as standalone projects inside a sub-directory.
This is why in the production version of the Omnisharp extension you get a launch config that assumes you want to run a project under {workspaceFolder}/Server using a standard .NET launch config.
{
"name": ".NET Core Launch (Blazor Standalone)",
"type": "coreclr",
"request": "launch",
"program": "dotnet",
"args": ["run"],
"cwd": "${workspaceFolder}/HostedDebug/Server",
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
In the pre-release version with the new Blazor debug adapter, you get a launch configuration that looks like this:
{
type: "blazorwasm",
....
cwd: "{workspaceFolder}/Server"
}
To resolve this, and likely other issues that are a result of hosted projects being incorrectly defined, we'll need to design a better heuristic to distinguish between hosted and standalone projects.
Most helpful comment
It appears that this bug has been around for quite a while.
A few days back @NTaylorMullen and I were doing some investigation into a broken launch configuration from a hosted project in an earlier version of Omnisharp. The launch config that was created didn't look correct, it was basically the launch config for a standalone web project but located within a server directory.
Now I realize that the logic within Omnisharp that determines whether a Blazor WASM project is hosted or standalone is a little wonky. It ends up categorizing all hosted projects as standalone projects inside a sub-directory.
This is why in the production version of the Omnisharp extension you get a launch config that assumes you want to run a project under
{workspaceFolder}/Serverusing a standard .NET launch config.In the pre-release version with the new Blazor debug adapter, you get a launch configuration that looks like this:
To resolve this, and likely other issues that are a result of hosted projects being incorrectly defined, we'll need to design a better heuristic to distinguish between hosted and standalone projects.