vscode-dev-containers icon indicating copy to clipboard operation
vscode-dev-containers copied to clipboard

dotnet image: "Wrong" non-feature pwsh is selected by terminal profile

Open JustinGrote opened this issue 2 years ago • 0 comments

  • VSCode Version: 1.69
  • Local OS Version: N/A
  • Local chip architecture: N/A
  • Reproduces in: Both
  • Name of Dev Container Definition with Issue: dotnet

Steps to Reproduce:

  1. Use default devcontainer config and specify powershell: latest in features and "terminal.integrated.defaultProfile.linux": "pwsh" in settings.
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/dotnet
{
	"name": "C# (.NET)",
	"build": {
		"dockerfile": "Dockerfile",
		"args": {
			// Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0
			// Append -bullseye or -focal to pin to an OS version.
			"VARIANT": "6.0-bullseye-slim",
			// Options
			"NODE_VERSION": "none"
		}
	},
	// Configure tool-specific properties.
	"customizations": {
		// Configure properties specific to VS Code.
		"vscode": {
			"settings": {
				"terminal.integrated.defaultProfile.linux": "pwsh"
			}
		}
	},
	"remoteUser": "vscode",
	"features": {
		"powershell": "latest"
	}
}
  1. Start devcontainer and click the "new terminal" button
  2. which pwsh will show this is running the powershell in /opt/powershell/7 rather than the one downloaded as a feature

This is because the dotnet image already ships with a powershell in /opt/powershell/7 and the default pwsh profile "resolver" seems to find this first rather than the one that gets placed in /usr/share/powershell/.store/powershell.linux.x64 by the feature. Starting pwsh from bash/zsh will also use the "wrong" one unless you explicitly specify /usr/bin/pwsh

Remediation

The feature script should probably check for this existing pwsh and remove the link if found.

Workaround

  1. "postCreateCommand": "sudo rm /usr/local/bin/pwsh"

JustinGrote avatar Jul 09 '22 02:07 JustinGrote