Windows CLI binary reports incorrect minor version in File Properties
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
**VS Code Version:** [Insert version here, e.g., 1.82.2]
**OS Version:** [Insert OS here, e.g., Windows 11]
**Steps to Reproduce:**
1. Build the VS Code CLI binary for a Windows target (e.g., `x86_64-pc-windows-msvc`).
2. Locate the compiled `code.exe` binary in Windows File Explorer.
3. Right-click the executable, select **Properties**, and navigate to the **Details** tab.
4. Compare the "File version" and "Product version" fields against the version string defined in the repository's `package.json`.
**Expected behavior:**
The Windows executable properties should accurately reflect the parsed `package.json` version. For example, version `1.82.2` should display as `1.82.2.0`.
**Actual behavior:**
The Windows executable properties display an incorrect, malformed version string where the minor version is `0`, the build version is the actual minor version, and the revision is the actual patch version. For example, version `1.82.2` displays as `1.0.82.2`.
**Code context:**
This occurs in `cli/build.rs` during the packaging of Windows resources. The 64-bit integer bitshifts applied to the parsed version numbers incorrectly map the minor version to the build field and the patch version to the revision field, while completely skipping the minor field (bits 32-47):
```rust
let major: u64 = version_parts.first().and_then(|v| v.parse().ok()).unwrap_or(0);
let minor: u64 = version_parts.get(1).and_then(|v| v.parse().ok()).unwrap_or(0);
let patch: u64 = version_parts.get(2).and_then(|v| v.parse().ok()).unwrap_or(0);
// ...
res.set_version_info(winresource::VersionInfo::FILEVERSION, (major << 48) | (minor << 16) | patch);
res.set_version_info(winresource::VersionInfo::PRODUCTVERSION, (major << 48) | (minor << 16) | patch);
```
Contributor guide
Assessment
This issue has not been assessed yet.