Skip to content

Fix ANGLE WinAppSDK download failure on 1ES agents - #4014

Merged
mattleibow merged 10 commits into
mainfrom
mattleibow/dev-fix-angle-winappsdk-download
May 22, 2026
Merged

mattleibow merged 10 commits into
mainfrom
mattleibow/dev-fix-angle-winappsdk-download

Conversation

@mattleibow

@mattleibow mattleibow commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The ANGLE WinUI build fails on internal DevDiv CI (1ES agents) because Python's urllib is blocked from making outbound HTTPS connections (WinError 10013). The existing winappsdk_setup.py script downloads a NuGet package using Python's HTTP stack, which doesn't work on restricted agents.

Root Cause

DevDiv 1ES hosted agents block Python.exe from making outbound HTTPS socket connections. .NET's HTTP stack works fine on the same agents. This started affecting builds when the agents were updated — it's not related to any code change.

Solution

Replace the Python-based WinAppSDK download and header generation with:

  1. Cake-based download — Downloads the NuGet package from the dnceng dotnet-public feed using .NET's DownloadFile(), which isn't blocked on 1ES agents. Version is read from VERSIONS.txt via GetVersion().

  2. PowerShell header generation script (generate_winappsdk_headers.ps1) — A checked-in, self-contained script that:

    • Takes a single -Path argument (WinAppSDK NuGet root)
    • Finds Windows SDK tools (winmdidl.exe, midlrt.exe) automatically
    • Dynamically discovers all .winmd files and processes them (no hardcoded lists)
    • Dynamically discovers all generated .idl files and runs midlrt on each
    • Creates empty stub headers when midlrt can't process an IDL (e.g. external package dependencies like Microsoft.Windows.ApplicationModel.Resources)
    • Runs under vcvarsall.bat so midlrt can find cl.exe

Key Design Decisions

  • Dynamic discovery over hardcoded lists — Both WINMD and IDL files are discovered via Get-ChildItem -Recurse, making the script forward-compatible with newer WinAppSDK versions without maintenance.
  • Graceful midlrt failure handling — Some IDL files reference metadata from external packages. Instead of aborting, the script creates empty stub headers with proper include guards. ANGLE only uses WinAppSDK for windowing/composition and doesn't need types from these external namespaces.
  • vcvarsall.bat integration — The script is invoked through the repo's vcvarsall wrapper to ensure cl.exe is on PATH (required by midlrt).

Files Changed

  • native/winui-angle/build.cake — Replaced Python script invocation with Cake download + PS1 invocation
  • native/winui-angle/generate_winappsdk_headers.ps1 — New self-contained PowerShell script for header generation

The DevDiv internal 1ES agents block Python's urllib from making
outbound HTTPS connections (WinError 10013), causing the ANGLE WinUI
build to fail when winappsdk_setup.py tries to download the
Microsoft.WindowsAppSDK NuGet package from nuget.org.

Replace the call to ANGLE's winappsdk_setup.py with a pure cake
implementation that:
- Downloads the .nupkg from the dnceng dotnet-public feed using
  Cake's DownloadFile (which uses .NET's HTTP stack)
- Extracts it with Unzip
- Processes WINMD files with winmdidl.exe directly
- Processes IDL files with midlrt.exe directly

This eliminates the Python network dependency entirely and uses a
feed (pkgs.dev.azure.com/dnceng) accessible from internal agents.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

📦 Try the packages from this PR

Warning

Do not run these scripts without first reviewing the code in this PR.

Step 1 — Download the packages

bash / macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.sh | bash -s -- 4014

PowerShell / Windows:

iex "& { $(irm https://raw.githubusercontent.com/mono/SkiaSharp/main/scripts/get-skiasharp-pr.ps1) } 4014"

Step 2 — Add the local NuGet source

dotnet nuget add source ~/.skiasharp/hives/pr-4014/packages --name skiasharp-pr-4014
More options
Option Description
--successful-only / -SuccessfulOnly Only use successful builds
--force / -Force Overwrite previously downloaded packages
--list / -List List available artifacts without downloading
--build-id ID / -BuildId ID Download from a specific build

Or download manually from Azure Pipelines — look for the nuget artifact on the build for this PR.

Remove the source when you're done:

dotnet nuget remove source skiasharp-pr-4014

@github-actions

github-actions Bot commented May 20, 2026 •

Copy link
Copy Markdown
Contributor

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Site
🔗 View Staging Docs
🔗 View Staging Gallery (Blazor)
🔗 View Staging Gallery (Uno Platform)
🔗 View Staging SkiaFiddle

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

mattleibow and others added 2 commits May 20, 2026 18:56
The midlrt.exe tool needs the C preprocessor (cl.exe) to process IDL
files. Without it in PATH, it fails with MIDL1005. Pass /cpp_cmd with
the full path to cl.exe found via VS_INSTALL.

Also fix the outer guard to check for the actual generated header file
instead of the nuspec, so retries after partial failures still attempt
header generation.

Co-authored-by: Copilot <[email protected]>
The /cpp_cmd flag doesn't handle paths with spaces properly. Instead,
temporarily add the cl.exe directory to PATH so midlrt can find it
naturally. Also fix IDL path construction to avoid doubled drive letters.

Co-authored-by: Copilot <[email protected]>
mattleibow and others added 3 commits May 20, 2026 19:50
…ulation

Generate a temp batch script with all winmdidl + midlrt commands and run it
under vcvarsall.bat, matching the original approach where Python was invoked
through the vcvarsall wrapper. This ensures the full MSVC environment is set
up correctly (cl.exe on PATH, include dirs, etc.) without relying on wildcards
to find specific tool directories.

Co-authored-by: Copilot <[email protected]>
Replace dynamically-generated batch code with a checked-in script that takes
win_sdk_bin, include_dir, and lib_dir as arguments. The cake file now simply
invokes it through vcvarsall.bat. This is easier to read, debug, and maintain.

Co-authored-by: Copilot <[email protected]>
The ps1 script takes just the WinAppSDK root path and finds the Windows SDK
tools itself. This simplifies the cake invocation to a single argument and
makes the script self-contained and easier to maintain.

Co-authored-by: Copilot <[email protected]>
midlrt resolves imported IDL files relative to CWD. Use Push-Location to
set the working directory to the include path before running midlrt, matching
the original Python script behavior (subprocess.run with cwd=include).

Co-authored-by: Copilot <[email protected]>
WinAppSDK 1.4 has additional namespaces (e.g. Microsoft.UI.Content) that
weren't in 1.3. Instead of maintaining a hardcoded IDL list, enumerate all
.idl files generated by winmdidl and run midlrt on each. This makes the
script forward-compatible with newer WinAppSDK versions.

Co-authored-by: Copilot <[email protected]>
The WINMD list was still hardcoded, missing files like
Microsoft.Windows.ApplicationModel.Resources.winmd that exist in the 1.4
package. Now both WINMD discovery and IDL processing are fully dynamic.

Co-authored-by: Copilot <[email protected]>
Some IDL files (e.g. Microsoft.Windows.ApplicationModel.Resources)
reference metadata from external packages that midlrt cannot resolve,
causing MIDL9008 errors. Instead of aborting, create empty stub headers
so downstream #includes don't fail — ANGLE doesn't use types from
these namespaces.

Co-authored-by: Copilot <[email protected]>
@mattleibow mattleibow changed the title Replace Python winappsdk download with cake-native implementation Fix ANGLE WinAppSDK download failure on 1ES agents May 21, 2026
@mattleibow
mattleibow merged commit b2cd033 into main May 22, 2026
6 of 7 checks passed
@mattleibow
mattleibow deleted the mattleibow/dev-fix-angle-winappsdk-download branch May 22, 2026 00:32
github-actions Bot pushed a commit that referenced this pull request May 22, 2026
mattleibow added a commit that referenced this pull request May 22, 2026
…ne (#4045)

[CI] Fix native build failures on release/3.119.x (#4045)

Context: #4014, #4022, #3743, #4013

Four independent CI failures were blocking all builds on the 3.119.x
release branch. Each fix is backported from main and adapted to the
older file layout (scripts/ vs scripts/infra/).

~~ ANGLE WinAppSDK download (WinError 10013) ~~

DevDiv 1ES agents block Python's urllib from making outbound HTTPS
connections. Replace the winappsdk_setup.py invocation with a Cake
DownloadFile() from dnceng's dotnet-public feed, followed by a new
PowerShell script (generate_winappsdk_headers.ps1) that runs winmdidl
+ midlrt to produce the C++ headers ANGLE needs.

~~ WASM Emscripten 2.0.6 hang ~~

The 2.0.6 build intermittently hangs in CI. No .NET release ever
consumed this version — it was a legacy artifact from early
experimentation. Remove it from the matrix and merge lists.

~~ Tizen SDK 6.1 permanently broken ~~

Samsung rebranded Tizen Studio to Tizen SDK starting with version 10.0
and the old 6.1 Certificate-Manager package fails deterministically
with NoClassDefFoundError. Update to SDK 10.0 with the new URL pattern.

~~ Alpine apk.static transient download failures ~~

GitLab returns intermittent HTTP 5xx for apk.static. Without --fail,
curl silently saves the error body and the script tries to chmod +x a
JSON string. Add --fail --retry 5 --retry-delay 10 --retry-all-errors.

Co-authored-by: Copilot <[email protected]>
mattleibow added a commit that referenced this pull request May 22, 2026
…ne (#4045)

[CI] Fix native build failures on release/3.119.x (#4045)

Context: #4014, #4022, #3743, #4013

Four independent CI failures were blocking all builds on the 3.119.x
release branch. Each fix is backported from main and adapted to the
older file layout (scripts/ vs scripts/infra/).

~~ ANGLE WinAppSDK download (WinError 10013) ~~

DevDiv 1ES agents block Python's urllib from making outbound HTTPS
connections. Replace the winappsdk_setup.py invocation with a Cake
DownloadFile() from dnceng's dotnet-public feed, followed by a new
PowerShell script (generate_winappsdk_headers.ps1) that runs winmdidl
+ midlrt to produce the C++ headers ANGLE needs.

~~ WASM Emscripten 2.0.6 hang ~~

The 2.0.6 build intermittently hangs in CI. No .NET release ever
consumed this version — it was a legacy artifact from early
experimentation. Remove it from the matrix and merge lists.

~~ Tizen SDK 6.1 permanently broken ~~

Samsung rebranded Tizen Studio to Tizen SDK starting with version 10.0
and the old 6.1 Certificate-Manager package fails deterministically
with NoClassDefFoundError. Update to SDK 10.0 with the new URL pattern.

~~ Alpine apk.static transient download failures ~~

GitLab returns intermittent HTTP 5xx for apk.static. Without --fail,
curl silently saves the error body and the script tries to chmod +x a
JSON string. Add --fail --retry 5 --retry-delay 10 --retry-all-errors.

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant