roslynator icon indicating copy to clipboard operation
roslynator copied to clipboard

Rosylnator complains about missing C# extension in devcontainer on first initialization

Open JustinGrote opened this issue 3 years ago • 0 comments
trafficstars

Probably a race condition as the extensions get installed somewhat simultaneously.

Reproduce

devcontainer.json

// 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": {
			// Add the IDs of extensions you want installed when the container is created.
			"extensions": [
				"ms-dotnettools.csharp",
				"ms-vscode.PowerShell-Preview",
				"josefpihrt-vscode.roslynator"
			],
			"settings": {
				"terminal.integrated.profiles.linux": {
					"pwsh": {
						"path": "/usr/bin/pwsh",
						"icon": "terminal-powershell"
					}
				},
				"terminal.integrated.defaultProfile.linux": "pwsh"
			}
		}
	},
	// Use 'forwardPorts' to make a list of ports inside the container available locally.
	// "forwardPorts": [5000, 5001],
	// [Optional] To reuse of your local HTTPS dev cert:
	//
	// 1. Export it locally using this command:
	//    * Windows PowerShell:
	//        dotnet dev-certs https --trust; dotnet dev-certs https -ep "$env:USERPROFILE/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
	//    * macOS/Linux terminal:
	//        dotnet dev-certs https --trust; dotnet dev-certs https -ep "${HOME}/.aspnet/https/aspnetapp.pfx" -p "SecurePwdGoesHere"
	//
	// 2. Uncomment these 'remoteEnv' lines:
	//    "remoteEnv": {
	// 	      "ASPNETCORE_Kestrel__Certificates__Default__Password": "SecurePwdGoesHere",
	//        "ASPNETCORE_Kestrel__Certificates__Default__Path": "/home/vscode/.aspnet/https/aspnetapp.pfx",
	//    },
	//
	// 3. Do one of the following depending on your scenario:
	//    * When using GitHub Codespaces and/or Remote - Containers:
	//      1. Start the container
	//      2. Drag ~/.aspnet/https/aspnetapp.pfx into the root of the file explorer
	//      3. Open a terminal in VS Code and run "mkdir -p /home/vscode/.aspnet/https && mv aspnetapp.pfx /home/vscode/.aspnet/https"
	//
	//    * If only using Remote - Containers with a local container, uncomment this line instead:
	//      "mounts": [ "source=${env:HOME}${env:USERPROFILE}/.aspnet/https,target=/home/vscode/.aspnet/https,type=bind" ],
	// Use 'postCreateCommand' to run commands after the container is created.
	"postCreateCommand": "sudo rm /usr/local/bin/pwsh",
	// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
	"remoteUser": "vscode",
	"features": {
		"git": "os-provided",
		"powershell": "7.2.5"
	}
}

{61E1C8F7-014E-45C9-8AE2-DFD1D7E921B8}

Workaround

If you don't specify the C# extension and only roslynator, it seems to handle the dependency resolution correctly and won't show an error (as far as I can tell in limited testing)

JustinGrote avatar Jul 09 '22 03:07 JustinGrote