Why our Windows build didn't start on a clean Windows

By Pavel Stegnii · Published · All articles

Short version. Every Windows download built by our release workflow needed VCRUNTIME140.dll, so on a Windows without the Visual C++ redistributable it exited with 0xC0000135 before drawing anything. Our .cargo/config.toml asks for a static C runtime, but the release workflow set RUSTFLAGS, and Cargo then ignores the config file's flags. CI never noticed because the build machines have the redistributable installed. A lab server without it caught it on 30 November 2026.

The symptom

On 30 November 2026 we set up OpenSSH Server on a Windows Server 2022 virtual machine (build 20348) in the lab, so we could run Windows checks from a Mac over SSH. The first thing we ran was the portable zip from the latest release build. myxterm.exe --version printed nothing and exited with code 0xC0000135. So did --self-check.

0xC0000135 is STATUS_DLL_NOT_FOUND: Windows couldn't load a DLL the program imports, so the program never reached its first line. The import table of myxterm.exe listed VCRUNTIME140.dll, the Microsoft C runtime that comes with the Visual C++ redistributable. A fresh Windows Server doesn't have it. The zip, the MSI and the Store package all ship the same exe, so all three were affected.

PowerShell shows that exit code as -1073741515: the same 32 bits read as a signed number.

The cause: one environment variable

Rust programs built for Windows with the MSVC toolchain link the C runtime dynamically unless you ask for +crt-static [3]. We had asked, in .cargo/config.toml:

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]

The release workflow sets RUSTFLAGS: -D warnings for every job, so that a warning fails the build. Cargo takes extra compiler flags from one source only. If RUSTFLAGS is set, the rustflags in the config file are not merged in; they are ignored [4]. Our release builds therefore compiled with -D warnings and nothing else, and linked the C runtime as a DLL.

Where the static C runtime flag got lost Cargo uses RUSTFLAGS from the workflow and ignores the rustflags in .cargo/config.toml. The exe then imports VCRUNTIME140.dll. It starts on the build machine, which has the Visual C++ redistributable, and fails on a clean Windows. .cargo/config.toml asks for +crt-static: ignored RUSTFLAGS="-D warnings" set by the release workflow: used myxterm.exe imports VCRUNTIME140.dll Build machine: starts the redistributable is installed Clean Windows: 0xC0000135 no VCRUNTIME140.dll on the system
The config file's flag lost to the environment variable, and only a machine without the runtime could tell.

We knew about this trap. Two days earlier, on 28 November, the first run on the same lab server had failed with VCRUNTIME140.dll was not found. That fix (commit ae3070e) put the flag in the config file, in the main CI workflow and in the release workflow's RUSTFLAGS, and made the main CI fail if the exe still imports the DLL. The same day, a rewrite of the release workflow that added the .deb, .rpm, AppImage, .dmg and .msi packages (commit 503740a) replaced that RUSTFLAGS line with plain -D warnings. The release workflow had no import check, so nothing failed.

Why CI was green

The release workflow did start the exe: after the build it ran myxterm.exe --version on the Windows runner. That passed, because the hosted Windows runners have the Visual C++ redistributable installed. A launch test on a machine that has every runtime proves very little about a machine that has none.

The fix

Pull request #48, merged on 30 November 2026 [1], changed two things in release-build.yml:

  • Windows release builds add the flag to RUSTFLAGS themselves, next to -D warnings.
  • The packaging step fails if myxterm.exe or the RDP helper still mentions VCRUNTIME140.dll. It doesn't need to run the exe, so the runner's installed runtime can't hide the problem.
if [[ "$RUNNER_OS" == Windows ]]; then
  export RUSTFLAGS="$RUSTFLAGS -C target-feature=+crt-static"
fi
...
for exe in target/release/myxterm.exe target/release/myxterm-rdp-engine.exe; do
  if [ -f "$exe" ] && grep -a -i -q 'vcruntime140\.dll' "$exe"; then
    echo "::error::$exe imports VCRUNTIME140.dll: it would not start on a clean Windows"; exit 1
  fi
done

Searching the binary for the DLL name is crude, but it is the same check the main CI already used, it needs no extra tools on the runner, and it fails in the right direction: a false alarm stops a release, a miss can't slip through quietly.

After the fix

We ran the build from the pull request on the same lab server [2]:

  • --version exits 0.
  • --self-check passed 7 of 7 checks in the signed-in desktop session, including starting the RDP helper and storing, reading back and deleting a test entry in Credential Manager.
  • Over an SSH key login, the Credential Manager check fails with ERROR_NO_SUCH_LOGON_SESSION. Windows gives a network logon with a key no credential vault, so MyXterm refuses to store secrets there and doesn't fall back to a file. That is the intended behaviour, and now we know what it looks like.

What we changed in how we test

  • A clean machine is part of the test setup. The lab Windows server doesn't have the Visual C++ redistributable, and we keep it that way for exactly this check.
  • A fix needs its test where the bug ships from. The 28 November fix added the import check to the main CI only. The downloads come from the release workflow, so that is where the regression got through. Now both workflows check.
  • Check the artifact, not the runner. Import checks look at what we ship. A launch on a build machine is a smoke test, not proof.
  • Settings that can be overridden get a test. A flag in a config file that an environment variable can silently replace needs a check on the output, not just a comment next to it.

The bug was in every Windows download from the release workflow until the fix. If you tried one and it didn't start, the current preview builds have the fix; the Windows download page has them.

Sources

Read on 1 December 2026. Pull requests, commits and the lab log are in the MyXterm repository.

  1. Pull request #48, Windows release builds need no Visual C++ runtime again: github.com/adramelech/MyXterm/pull/48, commit c3cc388
  2. Lab log of 30 November 2026, section 1: docs/testing/LAB_2026-11-30.md
  3. The Rust Reference, static and dynamic C runtimes: doc.rust-lang.org/reference/linkage.html
  4. The Cargo Book, configuration, build.rustflags: doc.rust-lang.org/cargo/reference/config.html

Last updated