Skip to content

VS Code allows incompatible local extension installation into Linux Codespace, leading to platform mismatch and "bad image format" errors #322103

@MSFTJim

Description

@MSFTJim

Does this issue occur when all extensions are disabled?: Not Applicable

The issue appears to be related to installation of a platform-specific extension into a remote Codespace environment.

  • VS Code Version: 1.125.1
  • OS Version: Host: Windows; Remote: GitHub Codespace (Linux/Ubuntu)

Steps to Reproduce

  1. Start a Linux GitHub Codespace from a Windows machine.
  2. Connect to the Codespace from an environment where Extension Marketplace access is unavailable or restricted.
  3. Attempt to install C# Dev Kit using the local installation workflow ("Install from Local" / local VSIX installation).
  4. Open a .NET project in the Codespace.
  5. Attempt to use C# Dev Kit functionality (debugging, project operations, etc.).

Expected Behavior

When connected to a Linux Codespace, VS Code should either:

  • Install the Linux-compatible version of the extension, or
  • Detect that the locally installed extension targets a different platform and block the installation (or provide a clear warning).

Actual Behavior

VS Code appeared to accept the local installation, but the resulting environment appeared to contain a mix of Windows and Linux components. The extension subsequently produced errors consistent with a platform mismatch, including "bad image format" failures when attempting to use C# Dev Kit functionality. This made the root cause difficult to diagnose.

The failure occurred at runtime rather than during installation. Had VS Code detected and blocked the platform mismatch during the installation workflow, the root cause would have been immediately obvious.

Additional Context

The following screenshot shows the BadImageFormatException observed within the Linux Codespace environment after the local extension installation workflow was used.

Image

While troubleshooting with members of the C# Dev Kit team, the symptoms were determined to be consistent with a Windows-targeted extension being used within a Linux Codespace environment.

The issue was ultimately resolved by creating a fresh Codespace from an environment with access to the Extension Marketplace and installing the extensions normally. After doing so, C# Dev Kit functioned as expected.

One team member suggested that VS Code should not allow local installation when a platform-specific extension package is incompatible with the target environment, as the current behavior can lead users into a difficult-to-diagnose configuration.

Suggested Improvement

During local extension installation, validate the extension's target platform against the remote execution environment (Codespaces, SSH, Dev Containers, etc.).

If the extension is incompatible:

  • Block installation, or
  • Display a prominent warning explaining the mismatch and potential consequences.

Metadata

Metadata

Assignees

Labels

new releaseIssues found in a recent release of VS Code

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions