[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6WZS15NPKE3ER8TS8ARD8A7":3,"skill-same:01M6WZS15NPKE3ER8TS8ARD8A7":127},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":60,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M6WZS15NPKE3ER8TS8ARD8A7","code-coverage-calculation",null,"EXPERIMENTAL. Calculate code coverage of a WinUI control or component (for example \"calculate coverage of control TitleBar\") by running only that component's tests on a local Hyper-V VM against the local build. Supports controls in Microsoft.UI.Xaml.Controls.dll and Microsoft.UI.Xaml.Controls.Tabular.dll, and dxaml types in Microsoft.ui.xaml.dll. Reports per-file and per-function line coverage that matches the ADO Code Coverage tab. Use for \"calculate\u002Fmeasure\u002Fget coverage of \u003Ccontrol>\", \"how much do \u003Ccontrol>'s tests cover\", or \"coverage before\u002Fafter my tests\" when you have a local build and a VM.","microsoft\u002Fmicrosoft-ui-xaml","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M6WZRE552HV7ZQFPSHT97PZA",8604,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"code","code coverage calculation","calculation","code coverage","coverage","calculate","how","only","reports","local","get","ui","line","types","xaml","you","cover","my","when","component","2026-11-10 10:12:30",false,"---\nname: code-coverage-calculation\ndescription: >-\n  EXPERIMENTAL. Calculate code coverage of a WinUI control or component (for example\n  \"calculate coverage of control TitleBar\") by running only that component's tests on a local\n  Hyper-V VM against the local build. Supports controls in Microsoft.UI.Xaml.Controls.dll and\n  Microsoft.UI.Xaml.Controls.Tabular.dll, and dxaml types in Microsoft.ui.xaml.dll. Reports per-file\n  and per-function line coverage that matches\n  the ADO Code Coverage tab. Use for \"calculate\u002Fmeasure\u002Fget coverage of \u003Ccontrol>\", \"how much do\n  \u003Ccontrol>'s tests cover\", or \"coverage before\u002Fafter my tests\" when you have a local build and a VM.\n---\n\n# WinUI component coverage from a local VM test run\n\n## Agent workflow (follow in order; every gate is mandatory)\n\nAll commands run from the repo root. `\u003Cskill>` = `.github\\skills\\code-coverage-calculation`.\n\n### Gate 0 - Prerequisites (check; stop and tell the user on failure)\n\n| Check | How | If missing |\n|---|---|---|\n| Local build of the flavor (default `amd64chk`), from the current branch | The module DLL exists under `BuildOutput\\bin\\amd64chk\\Product\\`, and for MUXC\u002FTabular the link log `BuildOutput\\obj\\amd64chk\\controls\\dev\\dll` (or `dll-tabular`) `\\**\\link.command.1.tlog` exists | Ask before building (10+ min), then run `.\\initrun.ps1 .\\build.cmd \u002Fq` from the repo root. |\n| VS Enterprise code coverage | `Microsoft.CodeCoverage.Console.exe` under `%ProgramFiles%\\Microsoft Visual Studio` | Stop; the user must install it. |\n| `dotnet-coverage` | `Get-Command dotnet-coverage` | Tell the user: `dotnet tool install --global dotnet-coverage` |\n| Hyper-V rights | `Get-VM` succeeds | Stop. Ask the user to add their account (from `whoami`) to **Hyper-V Administrators** in an elevated PowerShell window, then sign out and back in. Never elevate or add group members yourself. |\n\n### Gate 1 - VM details (strict: never start a run without them)\n\n**Before every coverage run, the user must explicitly confirm the VM or enter its details in this\nsession.** Never pick a VM silently, even if only one credential is cached. Never reuse a VM name,\nusername or password from memory, an earlier session, or an earlier run without asking again.\n\n1. Look for cached credentials. Match them against the real VM names, because the cache file name\n   replaces non-alphanumeric characters with `_` and can't be turned back into the VM name. This\n   shows the username only, never the password:\n   ```powershell\n   Get-VM | ForEach-Object {\n       $f = Join-Path $env:USERPROFILE \".winui-test\\vmcred-$($_.Name -replace '[^a-zA-Z0-9]','_').xml\"\n       if (Test-Path $f) { [pscustomobject]@{ VM = $_.Name; State = $_.State; UserName = (Import-Clixml $f).UserName; CacheFile = Split-Path $f -Leaf } }\n   }\n   ```\n   If two VMs share one `CacheFile` (for example `Test-VM` and `Test_VM`), don't offer the cache for\n   either; ask for details and re-enter the password (`-Force`).\n2. Use `ask_user` every time:\n   - **Cached credentials exist:** ask \"Is this the VM to use?\" Offer one choice per VM and\n     username listed above, plus **\"Enter different VM details\"**.\n   - **No cache, or the user chooses different details:** ask for the **VM name** and **VM username**\n     (the plain account name as shown on the VM, with no `.\\` or `VM\\` prefix).\n   - If the user declines or cancels, stop. Do not continue with a default.\n3. Run `tools\\Set-VmCredential.ps1 -VMName \u003Cvm> -UserName \u003Cuser>` (a shared repo tool):\n   - For new details, add `-Force`. The script asks for the **password in a separate window** (never in\n     chat; chat text is kept in session history) and writes the encrypted per-user cache\n     `%USERPROFILE%\\.winui-test\\vmcred-\u003Cvm>.xml`. This is the cache `tools\\run-tests-on-vm.ps1` and Steps 3-4 read;\n     Step 3 does not pass `-Credential` to the runner, so the cache must exist.\n   - For a confirmed cached VM, run it without `-Force`. It validates without prompting.\n   - Either way it checks that the VM exists and is Running, that the logon works, and that the user has an\n     Active desktop session. A new credential replaces the cache only after it validates.\n4. If the script fails (VM missing or stopped, bad password, no active desktop), report the message,\n   ask the user to fix it or give new details, and repeat this gate. Do not continue.\n\n### Gate 2 - Resolve the component and its tests\n\n**A. `controls\\dev` (`Microsoft.UI.Xaml.Controls.dll` or `Microsoft.UI.Xaml.Controls.Tabular.dll`)**\n\n1. Folder: match the name case-insensitively against `controls\\dev\\*` folders. If there's no match,\n   search `controls\\dev\\*\\*.idl` for `runtimeclass \u003CName>` and use that folder (for example\n   `ItemsRepeater` resolves to `Repeater`). If there are zero or several candidates, ask the user and offer the candidates.\n   **Module:** if `controls\\Tabular.ProjectImports.targets` imports `dev\\\u003CF>\\\u003CF>.vcxitems` (today: TableView,\n   TabularShaping, ShapedItemsSource, GroupedSourceAdapter, HierarchicalSourceAdapter, SortIndicator,\n   ResizeGripper), the code is in `Microsoft.UI.Xaml.Controls.Tabular.dll`: pass\n   `-Module Microsoft.UI.Xaml.Controls.Tabular.dll`. Otherwise it's `Microsoft.UI.Xaml.Controls.dll` (the default).\n2. Tests: list the `[TestClass]` classes (with their namespaces) in `controls\\dev\\\u003CF>\\APITests\\**\\*.cs`\n   and `controls\\dev\\\u003CF>\\InteractionTests\\**\\*.cs`. TAEF test names are `\u003Cnamespace>.\u003Cclass>.\u003Cmethod>`,\n   and `runtests` selects `@Name='*\u003Cfilter>'`.\n   - Prefer one wildcard that covers every class, usually `*.\u003CF>Tests.*`. It covers both the `ApiTests`\n     and `InteractionTests` classes, and namespaces such as `...ApiTests.RepeaterTests.*`.\n   - If no single wildcard covers them all, pass several filters (`-TestFilter 'a','b'`). Each runs\n     with its own collector, and the results are merged and deduplicated in the report.\n   - If the folder has no tests, tell the user and ask which tests to run.\n3. `-ComponentPathRegex`: take every `runtimeclass` `\u003CRC>` declared in `controls\\dev\\\u003CF>\\*.idl` and match\n   the folder plus both kinds of generated sources:\n   `\\\\controls\\\\dev\\\\\u003CF>\\\\|\\\\controls\\\\dev\\\\Generated\\\\(\u003CRC1>|\u003CRC2>|...)\\.|\\\\dll(-tabular)?\\\\generated\\\\(.+\\\\)?(\u003CRC1>|\u003CRC2>|...)\\.g\\.`\n   The second part covers `controls\\dev\\Generated\\\u003CRC>.properties.*` and the third covers the build-generated\n   `BuildOutput\\obj\\\u003Cflavor>\\controls\\dev\\dll\\generated\\...\\\u003CRC>.g.cpp\u002F.h` (or `dll-tabular\\generated`) files.\n4. Show the resolved plan (folder, module, test classes, filter(s), regex), then proceed. Ask only if\n   something is ambiguous.\n5. The build must contain those tests. Before instrumenting, the orchestrator lists the matching tests in\n   `TestPayload\\\u003Cflavor>` with TAEF (the same selection `runtests` uses on the VM) and stops in seconds if a\n   filter matches none. That usually means `BuildOutput` was built from an older commit or another branch.\n   Tell the user, ask before rebuilding (`.\\initrun.ps1 .\\build.cmd \u002Fq`), then rerun with `-RefreshPayload`.\n\n**B. Not in `controls\\dev`: investigate `dxaml` (MUX, `Microsoft.ui.xaml.dll`) and get approval**\n\n1. Sources: search `dxaml\\xcp` for the type, for example `core\\core\\elements\\\u003CName>.cpp`, `core\\inc\\\u003CName>.h`,\n   `dxaml\\lib\\\u003CName>_Partial.*`, `dxaml\\lib\\winrtgeneratedclasses\\\u003CName>.g.*`, `components\\**`, and\n   `core\\controls\\generated\\C\u003CName>*`. Decide which are in scope (for example whether `ButtonBase` counts for `Button`).\n2. Tests: `dxaml\\test\\native\\external\\\u003Carea>\\\u003Cname>\\` (C++ TAEF; names look like\n   `Microsoft::UI::Xaml::Tests::Controls::\u003CName>::\u003CClass>::\u003CMethod>`). Note each class's `Hosting:Mode`;\n   `runtests` cannot mix hosting modes in one filter, so use one filter per mode.\n3. Use `ask_user` to present the proposed source files and regex, test classes and filter(s), and module\n   `Microsoft.ui.xaml.dll`. Warn that MUX is about 71 MB, so the first instrumentation is likely to take\n   well over 40 minutes. **Do not run until the user approves.** Revise the plan with their feedback.\n\n**C. Found in neither place:** ask the user which source folder and tests to use. Other DLLs (for example\n`Microsoft.UI.Xaml.Phone.dll`) aren't supported yet; say so instead of measuring a different module.\n\n### Tell the user what the run does on the VM (before every run)\n\nThe run makes changes on the test VM, so say this once before starting:\n- It creates `C:\\WinUICoverage` (coverage tools, logs and output) and runs short-lived scheduled tasks\n  as the VM user. With `-MoveSessionToConsole` it also runs `tscon` as SYSTEM to move the session to the console.\n- It opens the coverage collector's named pipe (`\\\\.\\pipe\\CodeCoverage.pipe.\u003Cid>`) with a NULL DACL, so\n  low-integrity test processes can report coverage. **Any local user on the VM can connect to that pipe\n  until the run ends.** This is intended for a dedicated test VM; don't use it on a shared machine.\n- It temporarily replaces the module in the local `TestPayload` and in the VM's deployed payload with the\n  instrumented copy, and restores both afterwards (hash-checked). `BuildOutput` and sources are never changed.\n\n### Run\n\n- Output: `\u003Crepo>\\BuildOutput\\Coverage\\\u003Cflavor>\\\u003CComponent>` by default (git-ignored with `BuildOutput`).\n  Its `work\\` folder holds the relinked and instrumented DLLs and the payload backups (several hundred MB).\n- Add `-RefreshPayload` if `TestPayload\\x64chk` is missing or older than the build output. A failed\n  refresh stops the run.\n- Add `-MoveSessionToConsole` when the host is an RDP or Cloud PC session (`$env:SESSIONNAME -like 'RDP-*'`).\n- Tell the user the expected time first (about 30-60 min the first time for MUXC, mostly instrumentation; a few\n  minutes for the 6.5 MB Tabular DLL; about 6-10 min with the cache).\n  Run it async with a long wait. **Never stop the process during Step 2 or 3**; the restore runs in `finally`,\n  and if a run is killed anyway, the next run restores the payload before doing anything else.\n\nRun from the repo root in PowerShell, invoking the script directly. Don't use `pwsh -File`: it turns\n`'a','b'` into a single string.\n\n```powershell\n& .\\.github\\skills\\code-coverage-calculation\\scripts\\Invoke-WinUIVmCoverage.ps1 `\n    -RepoRoot (Get-Location).Path -VMName \u003Cvm> -TestFilter '\u003Cfilter>'[,'\u003Cfilter2>'] `\n    -ComponentName \u003CF> -ComponentPathRegex '\u003Cregex>' `\n    -Module \u003CMicrosoft.UI.Xaml.Controls.dll|Microsoft.UI.Xaml.Controls.Tabular.dll|Microsoft.ui.xaml.dll> `\n    [-RefreshPayload] [-MoveSessionToConsole]\n```\n\n### Report\n\n- If restoring the payload or VM fails, the command **fails** (after writing the report, if coverage was\n  collected) and `instrument-state.json` is kept. Tell the user prominently, and offer to rerun\n  `\u003Cskill>\\scripts\\Step4-Restore-Payload.ps1 -RepoRoot \u003Crepo> -WorkDir \u003COutputDir>\\work -VMName \u003Cvm>`\n  (or simply rerun the coverage command, which restores first).\n- From `report-\u003Cts>\\coverage-summary.md`, present the component total, the per-file table, and the\n  uncovered and partially covered functions. Point to `TreeReport\\coverage-tree.html` and the CSVs.\n- Check the test summary. If `Total=0`, the filter matched nothing; fix the filter instead of reporting 0 %.\n\n---\n\n# Reference\n\nMeasures **which lines of one component your selected tests execute**. It doesn't need a pipeline\nrun: it uses your local build and the same Hyper-V VM and runner (`tools\\run-tests-on-vm.ps1`) you\nalready use for WinUI tests. Everything it needs is in this folder.\n\n## How it works\n\n- **Instrumentable MUXC:** static native instrumentation needs CV and FIXUP debug info\n  (`\u002FDEBUGTYPE:CV,FIXUP` with `\u002FINCREMENTAL:NO`), which a chk MUXC link doesn't emit. Step 1 relinks a\n  copy with those flags from the recorded link command, without touching the repo or `BuildOutput`.\n- **Collection:** the DLL is instrumented once with a per-module session id and copied over every\n  payload copy, together with `static_covrun*.dll`. On the VM, a server-mode collector listens on a named pipe\n  that `lib\\Set-CoveragePipeAcl.ps1` opens to low-integrity test processes. Shutting the collector down\n  flushes the `.coverage` file.\n- **Accurate numbers:** merging native `.coverage` files to Cobertura repeats every line once per input\n  file, so naive totals undercount coverage. `lib\\Repair-CoverageDuplicates.ps1` and\n  `lib\\Split-CoverageByModule.ps1` keep one entry per (file, line), which matches the Azure DevOps Code\n  Coverage tab. `lib\\Get-FunctionCoverage.ps1` adds per-function detail from the native XML merge, and the\n  `Build-*TreeReport.ps1` scripts render single-file HTML reports. The PDB is only needed at instrument time.\n\n## Quick start\n\n```powershell\ncd \u003Crepo-root>\\.github\\skills\\code-coverage-calculation\\scripts\n.\\Invoke-WinUIVmCoverage.ps1 `\n    -RepoRoot   \u003Crepo-root> `\n    -VMName     \u003Cvm> `\n    -TestFilter '*.TitleBarTests.*' `\n    -ComponentName TitleBar `\n    -ComponentPathRegex '\\\\controls\\\\dev\\\\TitleBar\\\\|\\\\Generated\\\\TitleBar|\\\\generated\\\\Controls\\\\TitleBar' `\n    -MoveSessionToConsole `\n    -BaselinePerFileCsv '\u003Cbaseline-run>\\PerModule\\Microsoft.UI.Xaml.Controls\\corrected-per-file.csv' `\n    -BaselineLabel 'Full test pass'\n```\n\nOutput goes to `\u003Crepo-root>\\BuildOutput\\Coverage\\amd64chk\\TitleBar` unless you pass `-OutputDir`. If the baseline came from another checkout, also pass `-BaselineRepoRoot \u003Cthat checkout's root>`.\n\nOpen `\u003COutputDir>\\report-\u003Ctimestamp>\\coverage-summary.md`. Other outputs in that folder:\n- `component-per-file.csv`\n- `component-functions.csv`\n- `TreeReport\\coverage-tree.html`\n- `PerModule\\\u003CModule>\\corrected-per-file.csv` (whole module)\n\n## Prerequisites\n\n- **Local build:** a full local build of the flavor you test (default `amd64chk`), so that `BuildOutput\\obj\\...\\link.command.1.tlog`, the objs and the PDB exist. Also an existing `TestPayload\\x64chk`, created by any earlier `tools\\run-tests-on-vm.ps1` run, or pass `-RefreshPayload`.\n- **Visual Studio Enterprise (host):** supplies `Microsoft.CodeCoverage.Console.exe` for instrument, collect and shutdown, and the MSVC toolset that built the objs.\n- **`dotnet-coverage`:** `dotnet tool install --global dotnet-coverage`, used for the merge.\n- **VM access:**\n  - A running Hyper-V VM with the test user logged on, an unlocked interactive desktop, and the WinUI test prerun already done (any earlier `run-tests-on-vm.ps1` run does this).\n  - The host account must be a local admin or a member of Hyper-V Administrators.\n  - The VM credential must be cached in `%USERPROFILE%\\.winui-test\\vmcred-\u003CVM>.xml`, the same cache `run-tests-on-vm.ps1` uses.\n- **No VS or dotnet needed on the VM:** the collector tools are staged to `C:\\WinUICoverage\\CoverageTool` automatically.\n\n## What it does (and why)\n\n| Step | Script | Notes |\n|---|---|---|\n| 1 | `Step1-New-InstrumentableDll.ps1` | **MUXC and Tabular** (`Microsoft.UI.Xaml.Controls.Tabular.dll`, relinked from `controls\\dev\\dll-tabular`). chk MUXC is not instrumentable: the tool prints \"*Unable to obtain debug information. Link with the \u002FPROFILE linker switch.*\" and then **exits 0** with the image untouched. It needs `\u002FDEBUGTYPE:CV,FIXUP` with `\u002FINCREMENTAL:NO` at link time, and this skill never edits repo files, so the script re-runs the **exact link command MSBuild recorded** (`link.command.1.tlog`) with `\u002FDEBUGTYPE:CV,FIXUP` added and `\u002FINCREMENTAL:NO`. `\u002FOUT`, `\u002FPDB`, `\u002FIMPLIB` and `\u002FMAP` are redirected to `work\\relink`, and `\u002FWINMD:NO` is set. It takes about 15 s, and BuildOutput is never touched. MUX (`Microsoft.ui.xaml.dll`) already links with `\u002Fdebugtype:cv,fixup,pdata` and skips this step. |\n| 2 | `Step2-Instrument-Payload.ps1` | Static native instrumentation with a fresh 16-hex session id. **This is slow for a 38 MB chk DLL (about 20-50 min)**, so the result is cached in `work\\instrumented`, keyed by the input DLL's SHA256, and reused on later runs together with its baked-in session id. The cache is reused only while the tool that instrumented it still exists at the same version. The script catches the \"exit 0 but not instrumented\" case. It backs up every payload copy and writes `instrument-state.json` **before** overwriting anything (so an interrupted run can always be restored), then overwrites **every** payload copy of the DLL, plus `static_covrun64.dll`, because each test app loads its own co-located copy (`Test\\UnpackagedApps\\MUXControlsTestApp\\`). Backups are refreshed from the payload whenever a copy isn't instrumented, so a rebuilt payload is never restored to an older DLL. |\n| 3 | `Step3-Invoke-VmCoverageRun.ps1` | Stages the collector on the VM once. It starts `collect --server-mode --session-id \u003Csid>` as the VM user through an interactive scheduled task, waits for `\\\\.\\pipe\\CodeCoverage.pipe.\u003Csid>`, and sets a NULL DACL on it. It then runs `initrun.ps1 .\\tools\\run-tests-on-vm.ps1 -SkipPayload \u003Cfilter>`. `-SkipPayload` only stops the runner from regenerating `TestPayload` from BuildOutput (which would overwrite the instrumented DLLs); the runner still copies the changed payload files to the VM and runs the tests on the desktop. In `finally` it calls `shutdown \u003Csid>` so the collector writes the `.coverage` file, downloads it and the collector log (also when the run failed), and closes the VM session. |\n| 4 | `Step4-Restore-Payload.ps1` | Always runs, from `finally`, and again at the start of the next run if a previous run was killed before restoring. It restores every original DLL (copies that were never overwritten are skipped), hash-verified, removes `static_covrun*.dll`, and does the same in the VM's deployed payload. Each distinct original is restored to its own copies. If any VM copy doesn't match afterwards, it fails and keeps `instrument-state.json`, so you can simply run it again. A restore failure makes the whole command fail. |\n| 5 | `Step5-Get-ComponentCoverage.ps1` | Merges the coverage to Cobertura (`dotnet-coverage merge -f cobertura`) and applies the per-module (file, line) dedup (`lib\\Split-CoverageByModule.ps1`), the same correction that matches the ADO tab. It then filters to the component by `-ComponentPathRegex` and optionally compares with a baseline `corrected-per-file.csv`. Paths are matched repo-relative: the checkout root (`-RepoRoot`, or `-BaselineRepoRoot` for a baseline from another checkout) or a build-agent root such as `C:\\__w\\1\\s\\` is removed, the report warns if the baseline matches none or under half of the component files, and `x86chk` versus `amd64chk` doesn't matter. It also produces function-level coverage (`lib\\Get-FunctionCoverage.ps1`) and the HTML tree (`lib\\Build-CoverageTreeReport.ps1`). |\n\nYou can run the steps one at a time. Each writes its state or results under `\u003COutputDir>\\work`.\n\n## Timing\n\n- **First run:** about 30-60 min, almost all of it Step 2 instrumenting a 38 MB chk MUXC (20-50 min; it runs on a single core). The rest is a few seconds to relink, then deploy, the tests, flush and the report.\n- **Tabular (6.5 MB):** instrumentation takes only a few minutes.\n- **Later runs with an unchanged build:** about 6-10 min. The relink and the instrumented DLL are both reused from `\u003COutputDir>\\work`.\n- **Report:** parsing the Cobertura and native XML takes about 1-2 min each; skip the second with `-SkipFunctionCoverage`.\n\n## Verified result (TitleBar, 2026-10-06)\n\n`-TestFilter '*.TitleBarTests.*'` on a local Hyper-V VM (Windows 11, amd64chk): 24\u002F24 tests passed, and the collector produced an 88 MB `.coverage` file. These are the numbers from the full skill run, next to a baseline from a CI coverage run of all tests:\n\n| File | TitleBar tests only (this skill) | CI coverage run (all tests) |\n|---|---|---|\n| `controls\\dev\\TitleBar\\TitleBar.cpp` | **98.07 %** (507\u002F517) | 10.64 % (55\u002F517) |\n| `controls\\dev\\TitleBar\\TitleBarAutomationPeer.cpp` | **100 %** (17\u002F17) | 0 % (0\u002F17) |\n| `controls\\dev\\Generated\\TitleBar.properties.cpp` | **90.23 %** (157\u002F174) | 28.74 % (50\u002F174) |\n| All 15 TitleBar source files | **81.03 %** (773\u002F954) | 23.69 % (226\u002F954) |\n\nOf 45 functions in the TitleBar `.cpp` files, 40 are fully covered, 4 partially, and 1 not at all (`OnWindowRectChanged`). Afterwards, the payload, the VM and BuildOutput were all verified back at their original hashes.\n\n**Tabular module (TableView, 2026-10-20):** `-Module Microsoft.UI.Xaml.Controls.Tabular.dll -TestFilter '*.TableViewSortingTests.*'`: 35\u002F35 tests passed in 3 min 41 s end to end (instrumenting the 6.5 MB DLL took 45 s). From that one test class, TableView was at 3557\u002F11779 lines (30.2 %), with `TableView.cpp` at 63.8 %. The payload and the VM were restored afterwards.\n\n## Gotchas (learned the hard way)\n\n- **Host session disconnects (Cloud PC \u002F RDP):** if the host's session disconnects, the Hyper-V *enhanced session* stops delivering input. UI tests then fail with `InjectMouseInput ... Access is denied` and \"Test window lost focus\". Use `-MoveSessionToConsole`, which runs `tscon \u003Cid> \u002Fdest:console` as SYSTEM inside the VM, so the VM desktop stays interactive. Reconnecting with vmconnect moves the session back.\n- **Instrumenting is slow:** about 20-50 min and about 3 GB RAM for chk MUXC. Don't interrupt it; later runs reuse the cache. Use `-ForceReinstrument` after a rebuild if the hash didn't change but you want a new session id.\n- **Stale build:** if `BuildOutput` comes from another branch or an older commit, the payload may not contain the component's tests. The test check before Step 1 catches this; without it, TAEF reports \"The selection criteria did not match any tests\" on the VM and Step 3 fails after the long instrumentation.\n- **Incremental deploy manifest:** `tools\\run-tests-on-vm.ps1` only copies files whose size or timestamp changed since its last deploy (`TestPayload\\.deploy-manifest-\u003CVM>-\u003Cflavor>.json`). Step 4 restores the VM behind its back, and `static_covrun*.dll` always keep the tool's timestamp, so Step 3 removes the instrumented files from that manifest before every run. Without that, a rerun silently tests the original DLL (empty coverage), or the instrumented DLL is deployed without `static_covrun64.dll` and the test app crashes with \"ClassFactory cannot supply requested class\".\n- **Session id must match:** the DLL the test process loads must carry the collector's session id. If the coverage file is tiny or empty, check `work\\raw\\\u003Crun>\\collector.log` and confirm the app-local copy (`MUXControlsTestApp\\Microsoft.UI.Xaml.Controls.dll`) is the instrumented one.\n- **Rebuilds overwrite the instrumented copy:** rebuilding `MUXControlsTestApp` re-stages an older Controls DLL into `BuildOutput\\...\\UnpackagedApps\\MUXControlsTestApp`. That doesn't matter here because Step 2 overwrites the *payload* copies, but don't run `run-tests-on-vm.ps1` **without** `-SkipPayload` in between, because that recreates the payload.\n- **Expected failures still count toward coverage:** failing or ignored tests still execute product code until they fail, and Ignored tests don't run at all.\n- **Known crash at exit is harmless:** TitleBar runs fail-fast at app exit, which shows as cleanup errors. Coverage still flushes because the collector is out of process.\n- **Numbers differ from CI:** a local VM run uses a different OS build, flavor (x64 vs CI's x86) and test subset. Compare per file, not the module total.\n- **NULL DACL:** the collector pipe is open to every local user until shutdown, so that low-integrity test processes can connect (otherwise coverage is empty with ACCESS_DENIED). That's fine on a dedicated test VM, but avoid it on shared machines; the agent workflow tells the user before every run.\n- **`cmd \u002Fc` quoting:** starting the collector via `cmd \u002Fc \"\u003Cexe>\" ... > \"\u003Clog>\"` silently fails, because cmd strips the outer quotes. Step 3 therefore writes a `.cmd` wrapper. If the collector pipe never appears, check that wrapper and `C:\\WinUICoverage\\out\\collector-\u003Crun>.log` on the VM.\n- **Same tool for instrument and collect:** the collector must be the same `Microsoft.CodeCoverage.Console.exe` version that instrumented the DLL. Step 2 records the tool, and Step 3 stages that exact version to `C:\\WinUICoverage\\CoverageTool\\\u003Cversion>`. If that tool is gone or changed version (for example after a VS update), Step 2 re-instruments instead of reusing the cache. When several VS installs exist, the highest file version wins; path string order is not used.\n- **Relink is not byte-deterministic:** Step 1 therefore reuses its previous output while the recorded link inputs are unchanged. Otherwise the Step 2 cache, keyed by DLL hash, would miss and re-instrument for 45 minutes.\n- **Single-file bug in `lib\\Get-FunctionCoverage.ps1`:** with a single `.coverage` input, the script's own merge produces an empty `\u003Cresults\u002F>`. An if-expression unwraps the one-element array, so `@inputFiles` splats nothing. Step 5 works around this by pre-merging (`dotnet-coverage merge -f xml`) and calling the script with `-SkipMerge`, so the script itself is left as is.\n- **Host suspends pause the run:** a Cloud PC host that sleeps or suspends pauses instrumentation; it resumes and finishes afterwards. Keep the host awake for predictable timing.\n\n## Parameters (`Invoke-WinUIVmCoverage.ps1`)\n\n| Parameter | Default | Notes |\n|---|---|---|\n| `-RepoRoot` | required | WinUI checkout with a completed local build |\n| `-VMName` | required | Hyper-V VM |\n| `-TestFilter` | required | One or more filters passed to `run-tests-on-vm.ps1`, e.g. `*.TitleBarTests.*`. With several, Step 3 runs once per filter and Step 5 merges the `.coverage` files. |\n| `-OutputDir` | `\u003CRepoRoot>\\BuildOutput\\Coverage\\\u003CFlavor>\\\u003CComponentName>` | Work and report root (git-ignored by default) |\n| `-ComponentName` \u002F `-ComponentPathRegex` | TitleBar | Regex on the source path selecting the component's files |\n| `-Module` | `Microsoft.UI.Xaml.Controls.dll` | or `Microsoft.UI.Xaml.Controls.Tabular.dll` (TableView and the tabular helpers), or `Microsoft.ui.xaml.dll` |\n| `-Flavor` | `amd64chk` | Build flavor; payload `x64chk` |\n| `-BaselinePerFileCsv` \u002F `-BaselineLabel` \u002F `-BaselineRepoRoot` | none | A `corrected-per-file.csv` from another coverage run to compare with, e.g. `PerModule\\\u003CModule>\\corrected-per-file.csv` from an earlier run of this skill, or `lib\\Split-CoverageByModule.ps1` run over a CI build's merged Cobertura file |\n| `-MoveSessionToConsole` | off | Recommended on Cloud PC \u002F RDP hosts |\n| `-RefreshPayload` | off | Run `test\\CreateTestPayload.ps1` first; stops if it fails |\n| `-ForceReinstrument` | off | Ignore the instrumented-DLL cache |\n| `-SkipTestCheck` | off | Skip listing the matching tests in the payload (same test files and selection as `runtests`) before instrumenting |\n| `-SkipFunctionCoverage` | off | Skip the function-level merge |\n\n## Files in this skill\n\n| File | Purpose |\n|---|---|\n| `scripts\\Invoke-WinUIVmCoverage.ps1` | One-command orchestrator for Steps 1-5. Step 3 runs once per `-TestFilter`. The payload and VM are restored in `finally` (and at the start of the next run if a run was killed). |\n| `scripts\\Step1-New-InstrumentableDll.ps1` | Relinks MUXC or Tabular with `\u002FDEBUGTYPE:CV,FIXUP` from the recorded link command, outside BuildOutput. |\n| `scripts\\Step2-Instrument-Payload.ps1` | Static instrumentation (cached) and broadcast into `TestPayload\\\u003Cflavor>`, with backups. |\n| `scripts\\Step3-Invoke-VmCoverageRun.ps1` | Starts the collector on the VM, runs the tests through `tools\\run-tests-on-vm.ps1 -SkipPayload`, shuts the collector down and downloads the coverage file. |\n| `scripts\\Step4-Restore-Payload.ps1` | Restores the payload and the VM copies, hash-verified. |\n| `scripts\\Step5-Get-ComponentCoverage.ps1` | Merge, per-module dedup, component filter, baseline comparison, function coverage, HTML tree and `coverage-summary.md`. |\n| `scripts\\lib\\Set-CoveragePipeAcl.ps1` | Puts a NULL DACL on the collector's named pipe so low-integrity TAEF test processes can connect. |\n| `scripts\\lib\\Repair-CoverageDuplicates.ps1`, `Split-CoverageByModule.ps1` | Deduplicate merged Cobertura by (file, line), overall and per module, so the numbers match the Azure DevOps Code Coverage tab. |\n| `scripts\\lib\\Get-FunctionCoverage.ps1` | Per-function coverage from the native XML merge. |\n| `scripts\\lib\\Build-CoverageTreeReport.ps1`, `Build-FunctionCoverageTreeReport.ps1` | Single-file HTML folder\u002Ffile (and function) tree reports. |\n\nShared repo tool used by Gate 1: `tools\\Set-VmCredential.ps1` validates the VM, takes the password in a separate window, writes the encrypted credential cache (only after every check passes), and checks the logon and the active desktop.\n","# WinUI component coverage from a local VM test run\n\n## Agent workflow (follow in order; every gate is mandatory)\n\nAll commands run from the repo root. `\u003Cskill>` = `.github\\skills\\code-coverage-calculation`.\n\n### Gate 0 - Prerequisites (check; stop and tell the user on failure)\n\n| Check | How | If missing |\n|---|---|---|\n| Local build of the flavor (default `amd64chk`), from the current branch | The module DLL exists under `BuildOutput\\bin\\amd64chk\\Product\\`, and for MUXC\u002FTabular the link log `BuildOutput\\obj\\amd64chk\\controls\\dev\\dll` (or `dll-tabular`) `\\**\\link.command.1.tlog` exists | Ask before building (10+ min), then run `.\\initrun.ps1 .\\build.cmd \u002Fq` from the repo root. |\n| VS Enterprise code coverage | `Microsoft.CodeCoverage.Console.exe` under `%ProgramFiles%\\Microsoft Visual Studio` | Stop; the user must install it. |\n| `dotnet-coverage` | `Get-Command dotnet-coverage` | Tell the user: `dotnet tool install --global dotnet-coverage` |\n| Hyper-V rights | `Get-VM` succeeds | Stop. Ask the user to add their account (from `whoami`) to **Hyper-V Administrators** in an elevated PowerShell window, then sign out and back in. Never elevate or add group members yourself. |\n\n### Gate 1 - VM details (strict: never start a run without them)\n\n**Before every coverage run, the user must explicitly confirm the VM or enter its details in this\nsession.** Never pick a VM silently, even if only one credential is cached. Never reuse a VM name,\nusername or password from memory, an earlier session, or an earlier run without asking again.\n\n1. Look for cached credentials. Match them against the real VM names, because the cache file name\n   replaces non-alphanumeric characters with `_` and can't be turned back into the VM name. This\n   shows the username only, never the password:\n   ```powershell\n   Get-VM | ForEach-Object {\n       $f = Join-Path $env:USERPROFILE \".winui-test\\vmcred-$($_.Name -replace '[^a-zA-Z0-9]','_').xml\"\n       if (Test-Path $f) { [pscustomobject]@{ VM = $_.Name; State = $_.State; UserName = (Import-Clixml $f).UserName; CacheFile = Split-Path $f -Leaf } }\n   }\n   ```\n   If two VMs share one `CacheFile` (for example `Test-VM` and `Test_VM`), don't offer the cache for\n   either; ask for details and re-enter the password (`-Force`).\n2. Use `ask_user` every time:\n   - **Cached credentials exist:** ask \"Is this the VM to use?\" Offer one choice per VM and\n     username listed above, plus **\"Enter different VM details\"**.\n   - **No cache, or the user chooses different details:** ask for the **VM name** and **VM username**\n     (the plain account name as shown on the VM, with no `.\\` or `VM\\` prefix).\n   - If the user declines or cancels, stop. Do not continue with a default.\n3. Run `tools\\Set-VmCredential.ps1 -VMName \u003Cvm> -UserName \u003Cuser>` (a shared repo tool):\n   - For new details, add `-Force`. The script asks for the **password in a separate window** (never in\n     chat; chat text is kept in session history) and writes the encrypted per-user cache\n     `%USERPROFILE%\\.winui-test\\vmcred-\u003Cvm>.xml`. This is the cache `tools\\run-tests-on-vm.ps1` and Steps 3-4 read;\n     Step 3 does not pass `-Credential` to the runner, so the cache must exist.\n   - For a confirmed cached VM, run it without `-Force`. It validates without prompting.\n   - Either way it checks that the VM exists and is Running, that the logon works, and that the user has an\n     Active desktop session. A new credential replaces the cache only after it validates.\n4. If the script fails (VM missing or stopped, bad password, no active desktop), report the message,\n   ask the user to fix it or give new details, and repeat this gate. Do not continue.\n\n### Gate 2 - Resolve the component and its tests\n\n**A. `controls\\dev` (`Microsoft.UI.Xaml.Controls.dll` or `Microsoft.UI.Xaml.Controls.Tabular.dll`)**\n\n1. Folder: match the name case-insensitively against `controls\\dev\\*` folders. If there's no match,\n   search `controls\\dev\\*\\*.idl` for `runtimeclass \u003CName>` and use that folder (for example\n   `ItemsRepeater` resolves to `Repeater`). If there are zero or several candidates, ask the user and offer the candidates.\n   **Module:** if `controls\\Tabular.ProjectImports.targets` imports `dev\\\u003CF>\\\u003CF>.vcxitems` (today: TableView,\n   TabularShaping, ShapedItemsSource, GroupedSourceAdapter, HierarchicalSourceAdapter, SortIndicator,\n   ResizeGripper), the code is in `Microsoft.UI.Xaml.Controls.Tabular.dll`: pass\n   `-Module Microsoft.UI.Xaml.Controls.Tabular.dll`. Otherwise it's `Microsoft.UI.Xaml.Controls.dll` (the default).\n2. Tests: list the `[TestClass]` classes (with their namespaces) in `controls\\dev\\\u003CF>\\APITests\\**\\*.cs`\n   and `controls\\dev\\\u003CF>\\InteractionTests\\**\\*.cs`. TAEF test names are `\u003Cnamespace>.\u003Cclass>.\u003Cmethod>`,\n   and `runtests` selects `@Name='*\u003Cfilter>'`.\n   - Prefer one wildcard that covers every class, usually `*.\u003CF>Tests.*`. It covers both the `ApiTests`\n     and `InteractionTests` classes, and namespaces such as `...ApiTests.RepeaterTests.*`.\n   - If no single wildcard covers them all, pass several filters (`-TestFilter 'a','b'`). Each runs\n     with its own collector, and the results are merged and deduplicated in the report.\n   - If the folder has no tests, tell the user and ask which tests to run.\n3. `-ComponentPathRegex`: take every `runtimeclass` `\u003CRC>` declared in `controls\\dev\\\u003CF>\\*.idl` and match\n   the folder plus both kinds of generated sources:\n   `\\\\controls\\\\dev\\\\\u003CF>\\\\|\\\\controls\\\\dev\\\\Generated\\\\(\u003CRC1>|\u003CRC2>|...)\\.|\\\\dll(-tabular)?\\\\generated\\\\(.+\\\\)?(\u003CRC1>|\u003CRC2>|...)\\.g\\.`\n   The second part covers `controls\\dev\\Generated\\\u003CRC>.properties.*` and the third covers the build-generated\n   `BuildOutput\\obj\\\u003Cflavor>\\controls\\dev\\dll\\generated\\...\\\u003CRC>.g.cpp\u002F.h` (or `dll-tabular\\generated`) files.\n4. Show the resolved plan (folder, module, test classes, filter(s), regex), then proceed. Ask only if\n   something is ambiguous.\n5. The build must contain those tests. Before instrumenting, the orchestrator lists the matching tests in\n   `TestPayload\\\u003Cflavor>` with TAEF (the same selection `runtests` uses on the VM) and stops in seconds if a\n   filter matches none. That usually means `BuildOutput` was built from an older commit or another branch.\n   Tell the user, ask before rebuilding (`.\\initrun.ps1 .\\build.cmd \u002Fq`), then rerun with `-RefreshPayload`.\n\n**B. Not in `controls\\dev`: investigate `dxaml` (MUX, `Microsoft.ui.xaml.dll`) and get approval**\n\n1. Sources: search `dxaml\\xcp` for the type, for example `core\\core\\elements\\\u003CName>.cpp`, `core\\inc\\\u003CName>.h`,\n   `dxaml\\lib\\\u003CName>_Partial.*`, `dxaml\\lib\\winrtgeneratedclasses\\\u003CName>.g.*`, `components\\**`, and\n   `core\\controls\\generated\\C\u003CName>*`. Decide which are in scope (for example whether `ButtonBase` counts for `Button`).\n2. Tests: `dxaml\\test\\native\\external\\\u003Carea>\\\u003Cname>\\` (C++ TAEF; names look like\n   `Microsoft::UI::Xaml::Tests::Controls::\u003CName>::\u003CClass>::\u003CMethod>`). Note each class's `Hosting:Mode`;\n   `runtests` cannot mix hosting modes in one filter, so use one filter per mode.\n3. Use `ask_user` to present the proposed source files and regex, test classes and filter(s), and module\n   `Microsoft.ui.xaml.dll`. Warn that MUX is about 71 MB, so the first instrumentation is likely to take\n   well over 40 minutes. **Do not run until the user approves.** Revise the plan with their feedback.\n\n**C. Found in neither place:** ask the user which source folder and tests to use. Other DLLs (for example\n`Microsoft.UI.Xaml.Phone.dll`) aren't supported yet; say so instead of measuring a different module.\n\n### Tell the user what the run does on the VM (before every run)\n\nThe run makes changes on the test VM, so say this once before starting:\n- It creates `C:\\WinUICoverage` (coverage tools, logs and output) and runs short-lived scheduled tasks\n  as the VM user. With `-MoveSessionToConsole` it also runs `tscon` as SYSTEM to move the session to the console.\n- It opens the coverage collector's named pipe (`\\\\.\\pipe\\CodeCoverage.pipe.\u003Cid>`) with a NULL DACL, so\n  low-integrity test processes can report coverage. **Any local user on the VM can connect to that pipe\n  until the run ends.** This is intended for a dedicated test VM; don't use it on a shared machine.\n- It temporarily replaces the module in the local `TestPayload` and in the VM's deployed payload with the\n  instrumented copy, and restores both afterwards (hash-checked). `BuildOutput` and sources are never changed.\n\n### Run\n\n- Output: `\u003Crepo>\\BuildOutput\\Coverage\\\u003Cflavor>\\\u003CComponent>` by default (git-ignored with `BuildOutput`).\n  Its `work\\` folder holds the relinked and instrumented DLLs and the payload backups (several hundred MB).\n- Add `-RefreshPayload` if `TestPayload\\x64chk` is missing or older than the build output. A failed\n  refresh stops the run.\n- Add `-MoveSessionToConsole` when the host is an RDP or Cloud PC session (`$env:SESSIONNAME -like 'RDP-*'`).\n- Tell the user the expected time first (about 30-60 min the first time for MUXC, mostly instrumentation; a few\n  minutes for the 6.5 MB Tabular DLL; about 6-10 min with the cache).\n  Run it async with a long wait. **Never stop the process during Step 2 or 3**; the restore runs in `finally`,\n  and if a run is killed anyway, the next run restores the payload before doing anything else.\n\nRun from the repo root in PowerShell, invoking the script directly. Don't use `pwsh -File`: it turns\n`'a','b'` into a single string.\n\n```powershell\n& .\\.github\\skills\\code-coverage-calculation\\scripts\\Invoke-WinUIVmCoverage.ps1 `\n    -RepoRoot (Get-Location).Path -VMName \u003Cvm> -TestFilter '\u003Cfilter>'[,'\u003Cfilter2>'] `\n    -ComponentName \u003CF> -ComponentPathRegex '\u003Cregex>' `\n    -Module \u003CMicrosoft.UI.Xaml.Controls.dll|Microsoft.UI.Xaml.Controls.Tabular.dll|Microsoft.ui.xaml.dll> `\n    [-RefreshPayload] [-MoveSessionToConsole]\n```\n\n### Report\n\n- If restoring the payload or VM fails, the command **fails** (after writing the report, if coverage was\n  collected) and `instrument-state.json` is kept. Tell the user prominently, and offer to rerun\n  `\u003Cskill>\\scripts\\Step4-Restore-Payload.ps1 -RepoRoot \u003Crepo> -WorkDir \u003COutputDir>\\work -VMName \u003Cvm>`\n  (or simply rerun the coverage command, which restores first).\n- From `report-\u003Cts>\\coverage-summary.md`, present the component total, the per-file table, and the\n  uncovered and partially covered functions. Point to `TreeReport\\coverage-tree.html` and the CSVs.\n- Check the test summary. If `Total=0`, the filter matched nothing; fix the filter instead of reporting 0 %.\n\n---\n\n# Reference\n\nMeasures **which lines of one component your selected tests execute**. It doesn't need a pipeline\nrun: it uses your local build and the same Hyper-V VM and runner (`tools\\run-tests-on-vm.ps1`) you\nalready use for WinUI tests. Everything it needs is in this folder.\n\n## How it works\n\n- **Instrumentable MUXC:** static native instrumentation needs CV and FIXUP debug info\n  (`\u002FDEBUGTYPE:CV,FIXUP` with `\u002FINCREMENTAL:NO`), which a chk MUXC link doesn't emit. Step 1 relinks a\n  copy with those flags from the recorded link command, without touching the repo or `BuildOutput`.\n- **Collection:** the DLL is instrumented once with a per-module session id and copied over every\n  payload copy, together with `static_covrun*.dll`. On the VM, a server-mode collector listens on a named pipe\n  that `lib\\Set-CoveragePipeAcl.ps1` opens to low-integrity test processes. Shutting the collector down\n  flushes the `.coverage` file.\n- **Accurate numbers:** merging native `.coverage` files to Cobertura repeats every line once per input\n  file, so naive totals undercount coverage. `lib\\Repair-CoverageDuplicates.ps1` and\n  `lib\\Split-CoverageByModule.ps1` keep one entry per (file, line), which matches the Azure DevOps Code\n  Coverage tab. `lib\\Get-FunctionCoverage.ps1` adds per-function detail from the native XML merge, and the\n  `Build-*TreeReport.ps1` scripts render single-file HTML reports. The PDB is only needed at instrument time.\n\n## Quick start\n\n```powershell\ncd \u003Crepo-root>\\.github\\skills\\code-coverage-calculation\\scripts\n.\\Invoke-WinUIVmCoverage.ps1 `\n    -RepoRoot   \u003Crepo-root> `\n    -VMName     \u003Cvm> `\n    -TestFilter '*.TitleBarTests.*' `\n    -ComponentName TitleBar `\n    -ComponentPathRegex '\\\\controls\\\\dev\\\\TitleBar\\\\|\\\\Generated\\\\TitleBar|\\\\generated\\\\Controls\\\\TitleBar' `\n    -MoveSessionToConsole `\n    -BaselinePerFileCsv '\u003Cbaseline-run>\\PerModule\\Microsoft.UI.Xaml.Controls\\corrected-per-file.csv' `\n    -BaselineLabel 'Full test pass'\n```\n\nOutput goes to `\u003Crepo-root>\\BuildOutput\\Coverage\\amd64chk\\TitleBar` unless you pass `-OutputDir`. If the baseline came from another checkout, also pass `-BaselineRepoRoot \u003Cthat checkout's root>`.\n\nOpen `\u003COutputDir>\\report-\u003Ctimestamp>\\coverage-summary.md`. Other outputs in that folder:\n- `component-per-file.csv`\n- `component-functions.csv`\n- `TreeReport\\coverage-tree.html`\n- `PerModule\\\u003CModule>\\corrected-per-file.csv` (whole module)\n\n## Prerequisites\n\n- **Local build:** a full local build of the flavor you test (default `amd64chk`), so that `BuildOutput\\obj\\...\\link.command.1.tlog`, the objs and the PDB exist. Also an existing `TestPayload\\x64chk`, created by any earlier `tools\\run-tests-on-vm.ps1` run, or pass `-RefreshPayload`.\n- **Visual Studio Enterprise (host):** supplies `Microsoft.CodeCoverage.Console.exe` for instrument, collect and shutdown, and the MSVC toolset that built the objs.\n- **`dotnet-coverage`:** `dotnet tool install --global dotnet-coverage`, used for the merge.\n- **VM access:**\n  - A running Hyper-V VM with the test user logged on, an unlocked interactive desktop, and the WinUI test prerun already done (any earlier `run-tests-on-vm.ps1` run does this).\n  - The host account must be a local admin or a member of Hyper-V Administrators.\n  - The VM credential must be cached in `%USERPROFILE%\\.winui-test\\vmcred-\u003CVM>.xml`, the same cache `run-tests-on-vm.ps1` uses.\n- **No VS or dotnet needed on the VM:** the collector tools are staged to `C:\\WinUICoverage\\CoverageTool` automatically.\n\n## What it does (and why)\n\n| Step | Script | Notes |\n|---|---|---|\n| 1 | `Step1-New-InstrumentableDll.ps1` | **MUXC and Tabular** (`Microsoft.UI.Xaml.Controls.Tabular.dll`, relinked from `controls\\dev\\dll-tabular`). chk MUXC is not instrumentable: the tool prints \"*Unable to obtain debug information. Link with the \u002FPROFILE linker switch.*\" and then **exits 0** with the image untouched. It needs `\u002FDEBUGTYPE:CV,FIXUP` with `\u002FINCREMENTAL:NO` at link time, and this skill never edits repo files, so the script re-runs the **exact link command MSBuild recorded** (`link.command.1.tlog`) with `\u002FDEBUGTYPE:CV,FIXUP` added and `\u002FINCREMENTAL:NO`. `\u002FOUT`, `\u002FPDB`, `\u002FIMPLIB` and `\u002FMAP` are redirected to `work\\relink`, and `\u002FWINMD:NO` is set. It takes about 15 s, and BuildOutput is never touched. MUX (`Microsoft.ui.xaml.dll`) already links with `\u002Fdebugtype:cv,fixup,pdata` and skips this step. |\n| 2 | `Step2-Instrument-Payload.ps1` | Static native instrumentation with a fresh 16-hex session id. **This is slow for a 38 MB chk DLL (about 20-50 min)**, so the result is cached in `work\\instrumented`, keyed by the input DLL's SHA256, and reused on later runs together with its baked-in session id. The cache is reused only while the tool that instrumented it still exists at the same version. The script catches the \"exit 0 but not instrumented\" case. It backs up every payload copy and writes `instrument-state.json` **before** overwriting anything (so an interrupted run can always be restored), then overwrites **every** payload copy of the DLL, plus `static_covrun64.dll`, because each test app loads its own co-located copy (`Test\\UnpackagedApps\\MUXControlsTestApp\\`). Backups are refreshed from the payload whenever a copy isn't instrumented, so a rebuilt payload is never restored to an older DLL. |\n| 3 | `Step3-Invoke-VmCoverageRun.ps1` | Stages the collector on the VM once. It starts `collect --server-mode --session-id \u003Csid>` as the VM user through an interactive scheduled task, waits for `\\\\.\\pipe\\CodeCoverage.pipe.\u003Csid>`, and sets a NULL DACL on it. It then runs `initrun.ps1 .\\tools\\run-tests-on-vm.ps1 -SkipPayload \u003Cfilter>`. `-SkipPayload` only stops the runner from regenerating `TestPayload` from BuildOutput (which would overwrite the instrumented DLLs); the runner still copies the changed payload files to the VM and runs the tests on the desktop. In `finally` it calls `shutdown \u003Csid>` so the collector writes the `.coverage` file, downloads it and the collector log (also when the run failed), and closes the VM session. |\n| 4 | `Step4-Restore-Payload.ps1` | Always runs, from `finally`, and again at the start of the next run if a previous run was killed before restoring. It restores every original DLL (copies that were never overwritten are skipped), hash-verified, removes `static_covrun*.dll`, and does the same in the VM's deployed payload. Each distinct original is restored to its own copies. If any VM copy doesn't match afterwards, it fails and keeps `instrument-state.json`, so you can simply run it again. A restore failure makes the whole command fail. |\n| 5 | `Step5-Get-ComponentCoverage.ps1` | Merges the coverage to Cobertura (`dotnet-coverage merge -f cobertura`) and applies the per-module (file, line) dedup (`lib\\Split-CoverageByModule.ps1`), the same correction that matches the ADO tab. It then filters to the component by `-ComponentPathRegex` and optionally compares with a baseline `corrected-per-file.csv`. Paths are matched repo-relative: the checkout root (`-RepoRoot`, or `-BaselineRepoRoot` for a baseline from another checkout) or a build-agent root such as `C:\\__w\\1\\s\\` is removed, the report warns if the baseline matches none or under half of the component files, and `x86chk` versus `amd64chk` doesn't matter. It also produces function-level coverage (`lib\\Get-FunctionCoverage.ps1`) and the HTML tree (`lib\\Build-CoverageTreeReport.ps1`). |\n\nYou can run the steps one at a time. Each writes its state or results under `\u003COutputDir>\\work`.\n\n## Timing\n\n- **First run:** about 30-60 min, almost all of it Step 2 instrumenting a 38 MB chk MUXC (20-50 min; it runs on a single core). The rest is a few seconds to relink, then deploy, the tests, flush and the report.\n- **Tabular (6.5 MB):** instrumentation takes only a few minutes.\n- **Later runs with an unchanged build:** about 6-10 min. The relink and the instrumented DLL are both reused from `\u003COutputDir>\\work`.\n- **Report:** parsing the Cobertura and native XML takes about 1-2 min each; skip the second with `-SkipFunctionCoverage`.\n\n## Verified result (TitleBar, 2026-10-06)\n\n`-TestFilter '*.TitleBarTests.*'` on a local Hyper-V VM (Windows 11, amd64chk): 24\u002F24 tests passed, and the collector produced an 88 MB `.coverage` file. These are the numbers from the full skill run, next to a baseline from a CI coverage run of all tests:\n\n| File | TitleBar tests only (this skill) | CI coverage run (all tests) |\n|---|---|---|\n| `controls\\dev\\TitleBar\\TitleBar.cpp` | **98.07 %** (507\u002F517) | 10.64 % (55\u002F517) |\n| `controls\\dev\\TitleBar\\TitleBarAutomationPeer.cpp` | **100 %** (17\u002F17) | 0 % (0\u002F17) |\n| `controls\\dev\\Generated\\TitleBar.properties.cpp` | **90.23 %** (157\u002F174) | 28.74 % (50\u002F174) |\n| All 15 TitleBar source files | **81.03 %** (773\u002F954) | 23.69 % (226\u002F954) |\n\nOf 45 functions in the TitleBar `.cpp` files, 40 are fully covered, 4 partially, and 1 not at all (`OnWindowRectChanged`). Afterwards, the payload, the VM and BuildOutput were all verified back at their original hashes.\n\n**Tabular module (TableView, 2026-10-20):** `-Module Microsoft.UI.Xaml.Controls.Tabular.dll -TestFilter '*.TableViewSortingTests.*'`: 35\u002F35 tests passed in 3 min 41 s end to end (instrumenting the 6.5 MB DLL took 45 s). From that one test class, TableView was at 3557\u002F11779 lines (30.2 %), with `TableView.cpp` at 63.8 %. The payload and the VM were restored afterwards.\n\n## Gotchas (learned the hard way)\n\n- **Host session disconnects (Cloud PC \u002F RDP):** if the host's session disconnects, the Hyper-V *enhanced session* stops delivering input. UI tests then fail with `InjectMouseInput ... Access is denied` and \"Test window lost focus\". Use `-MoveSessionToConsole`, which runs `tscon \u003Cid> \u002Fdest:console` as SYSTEM inside the VM, so the VM desktop stays interactive. Reconnecting with vmconnect moves the session back.\n- **Instrumenting is slow:** about 20-50 min and about 3 GB RAM for chk MUXC. Don't interrupt it; later runs reuse the cache. Use `-ForceReinstrument` after a rebuild if the hash didn't change but you want a new session id.\n- **Stale build:** if `BuildOutput` comes from another branch or an older commit, the payload may not contain the component's tests. The test check before Step 1 catches this; without it, TAEF reports \"The selection criteria did not match any tests\" on the VM and Step 3 fails after the long instrumentation.\n- **Incremental deploy manifest:** `tools\\run-tests-on-vm.ps1` only copies files whose size or timestamp changed since its last deploy (`TestPayload\\.deploy-manifest-\u003CVM>-\u003Cflavor>.json`). Step 4 restores the VM behind its back, and `static_covrun*.dll` always keep the tool's timestamp, so Step 3 removes the instrumented files from that manifest before every run. Without that, a rerun silently tests the original DLL (empty coverage), or the instrumented DLL is deployed without `static_covrun64.dll` and the test app crashes with \"ClassFactory cannot supply requested class\".\n- **Session id must match:** the DLL the test process loads must carry the collector's session id. If the coverage file is tiny or empty, check `work\\raw\\\u003Crun>\\collector.log` and confirm the app-local copy (`MUXControlsTestApp\\Microsoft.UI.Xaml.Controls.dll`) is the instrumented one.\n- **Rebuilds overwrite the instrumented copy:** rebuilding `MUXControlsTestApp` re-stages an older Controls DLL into `BuildOutput\\...\\UnpackagedApps\\MUXControlsTestApp`. That doesn't matter here because Step 2 overwrites the *payload* copies, but don't run `run-tests-on-vm.ps1` **without** `-SkipPayload` in between, because that recreates the payload.\n- **Expected failures still count toward coverage:** failing or ignored tests still execute product code until they fail, and Ignored tests don't run at all.\n- **Known crash at exit is harmless:** TitleBar runs fail-fast at app exit, which shows as cleanup errors. Coverage still flushes because the collector is out of process.\n- **Numbers differ from CI:** a local VM run uses a different OS build, flavor (x64 vs CI's x86) and test subset. Compare per file, not the module total.\n- **NULL DACL:** the collector pipe is open to every local user until shutdown, so that low-integrity test processes can connect (otherwise coverage is empty with ACCESS_DENIED). That's fine on a dedicated test VM, but avoid it on shared machines; the agent workflow tells the user before every run.\n- **`cmd \u002Fc` quoting:** starting the collector via `cmd \u002Fc \"\u003Cexe>\" ... > \"\u003Clog>\"` silently fails, because cmd strips the outer quotes. Step 3 therefore writes a `.cmd` wrapper. If the collector pipe never appears, check that wrapper and `C:\\WinUICoverage\\out\\collector-\u003Crun>.log` on the VM.\n- **Same tool for instrument and collect:** the collector must be the same `Microsoft.CodeCoverage.Console.exe` version that instrumented the DLL. Step 2 records the tool, and Step 3 stages that exact version to `C:\\WinUICoverage\\CoverageTool\\\u003Cversion>`. If that tool is gone or changed version (for example after a VS update), Step 2 re-instruments instead of reusing the cache. When several VS installs exist, the highest file version wins; path string order is not used.\n- **Relink is not byte-deterministic:** Step 1 therefore reuses its previous output while the recorded link inputs are unchanged. Otherwise the Step 2 cache, keyed by DLL hash, would miss and re-instrument for 45 minutes.\n- **Single-file bug in `lib\\Get-FunctionCoverage.ps1`:** with a single `.coverage` input, the script's own merge produces an empty `\u003Cresults\u002F>`. An if-expression unwraps the one-element array, so `@inputFiles` splats nothing. Step 5 works around this by pre-merging (`dotnet-coverage merge -f xml`) and calling the script with `-SkipMerge`, so the script itself is left as is.\n- **Host suspends pause the run:** a Cloud PC host that sleeps or suspends pauses instrumentation; it resumes and finishes afterwards. Keep the host awake for predictable timing.\n\n## Parameters (`Invoke-WinUIVmCoverage.ps1`)\n\n| Parameter | Default | Notes |\n|---|---|---|\n| `-RepoRoot` | required | WinUI checkout with a completed local build |\n| `-VMName` | required | Hyper-V VM |\n| `-TestFilter` | required | One or more filters passed to `run-tests-on-vm.ps1`, e.g. `*.TitleBarTests.*`. With several, Step 3 runs once per filter and Step 5 merges the `.coverage` files. |\n| `-OutputDir` | `\u003CRepoRoot>\\BuildOutput\\Coverage\\\u003CFlavor>\\\u003CComponentName>` | Work and report root (git-ignored by default) |\n| `-ComponentName` \u002F `-ComponentPathRegex` | TitleBar | Regex on the source path selecting the component's files |\n| `-Module` | `Microsoft.UI.Xaml.Controls.dll` | or `Microsoft.UI.Xaml.Controls.Tabular.dll` (TableView and the tabular helpers), or `Microsoft.ui.xaml.dll` |\n| `-Flavor` | `amd64chk` | Build flavor; payload `x64chk` |\n| `-BaselinePerFileCsv` \u002F `-BaselineLabel` \u002F `-BaselineRepoRoot` | none | A `corrected-per-file.csv` from another coverage run to compare with, e.g. `PerModule\\\u003CModule>\\corrected-per-file.csv` from an earlier run of this skill, or `lib\\Split-CoverageByModule.ps1` run over a CI build's merged Cobertura file |\n| `-MoveSessionToConsole` | off | Recommended on Cloud PC \u002F RDP hosts |\n| `-RefreshPayload` | off | Run `test\\CreateTestPayload.ps1` first; stops if it fails |\n| `-ForceReinstrument` | off | Ignore the instrumented-DLL cache |\n| `-SkipTestCheck` | off | Skip listing the matching tests in the payload (same test files and selection as `runtests`) before instrumenting |\n| `-SkipFunctionCoverage` | off | Skip the function-level merge |\n\n## Files in this skill\n\n| File | Purpose |\n|---|---|\n| `scripts\\Invoke-WinUIVmCoverage.ps1` | One-command orchestrator for Steps 1-5. Step 3 runs once per `-TestFilter`. The payload and VM are restored in `finally` (and at the start of the next run if a run was killed). |\n| `scripts\\Step1-New-InstrumentableDll.ps1` | Relinks MUXC or Tabular with `\u002FDEBUGTYPE:CV,FIXUP` from the recorded link command, outside BuildOutput. |\n| `scripts\\Step2-Instrument-Payload.ps1` | Static instrumentation (cached) and broadcast into `TestPayload\\\u003Cflavor>`, with backups. |\n| `scripts\\Step3-Invoke-VmCoverageRun.ps1` | Starts the collector on the VM, runs the tests through `tools\\run-tests-on-vm.ps1 -SkipPayload`, shuts the collector down and downloads the coverage file. |\n| `scripts\\Step4-Restore-Payload.ps1` | Restores the payload and the VM copies, hash-verified. |\n| `scripts\\Step5-Get-ComponentCoverage.ps1` | Merge, per-module dedup, component filter, baseline comparison, function coverage, HTML tree and `coverage-summary.md`. |\n| `scripts\\lib\\Set-CoveragePipeAcl.ps1` | Puts a NULL DACL on the collector's named pipe so low-integrity TAEF test processes can connect. |\n| `scripts\\lib\\Repair-CoverageDuplicates.ps1`, `Split-CoverageByModule.ps1` | Deduplicate merged Cobertura by (file, line), overall and per module, so the numbers match the Azure DevOps Code Coverage tab. |\n| `scripts\\lib\\Get-FunctionCoverage.ps1` | Per-function coverage from the native XML merge. |\n| `scripts\\lib\\Build-CoverageTreeReport.ps1`, `Build-FunctionCoverageTreeReport.ps1` | Single-file HTML folder\u002Ffile (and function) tree reports. |\n\nShared repo tool used by Gate 1: `tools\\Set-VmCredential.ps1` validates the VM, takes the password in a separate window, writes the encrypted credential cache (only after every check passes), and checks the logon and the active desktop.\n",{"name":5,"description":7},"main","74c2cab127943565ca2a278cc8f64f472209dd14",".github\u002Fskills\u002Fcode-coverage-calculation",965,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-14 21:05:35",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add microsoft\u002Fmicrosoft-ui-xaml --skill code-coverage-calculation",{"tool":69,"command":70},"bunx","bunx skills add microsoft\u002Fmicrosoft-ui-xaml --skill code-coverage-calculation",{"tool":72,"command":73},"pnpm","pnpm dlx skills add microsoft\u002Fmicrosoft-ui-xaml --skill code-coverage-calculation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002FSKILL.md",true,[77,83,87,91,95,99,103,107,111,115,119,123],{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"scripts\u002FInvoke-WinUIVmCoverage.ps1","SCRIPT","脚本",11690,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002FInvoke-WinUIVmCoverage.ps1",{"path":84,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":85,"sourceHtmlUrl":86},"scripts\u002Flib\u002FBuild-CoverageTreeReport.ps1",20112,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002Flib\u002FBuild-CoverageTreeReport.ps1",{"path":88,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":89,"sourceHtmlUrl":90},"scripts\u002Flib\u002FBuild-FunctionCoverageTreeReport.ps1",24440,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002Flib\u002FBuild-FunctionCoverageTreeReport.ps1",{"path":92,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":93,"sourceHtmlUrl":94},"scripts\u002Flib\u002FGet-FunctionCoverage.ps1",20270,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002Flib\u002FGet-FunctionCoverage.ps1",{"path":96,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":97,"sourceHtmlUrl":98},"scripts\u002Flib\u002FRepair-CoverageDuplicates.ps1",11164,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002Flib\u002FRepair-CoverageDuplicates.ps1",{"path":100,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":101,"sourceHtmlUrl":102},"scripts\u002Flib\u002FSet-CoveragePipeAcl.ps1",3794,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002Flib\u002FSet-CoveragePipeAcl.ps1",{"path":104,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":105,"sourceHtmlUrl":106},"scripts\u002Flib\u002FSplit-CoverageByModule.ps1",11439,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002Flib\u002FSplit-CoverageByModule.ps1",{"path":108,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":109,"sourceHtmlUrl":110},"scripts\u002FStep1-New-InstrumentableDll.ps1",6377,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002FStep1-New-InstrumentableDll.ps1",{"path":112,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":113,"sourceHtmlUrl":114},"scripts\u002FStep2-Instrument-Payload.ps1",10527,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002FStep2-Instrument-Payload.ps1",{"path":116,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":117,"sourceHtmlUrl":118},"scripts\u002FStep3-Invoke-VmCoverageRun.ps1",14445,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002FStep3-Invoke-VmCoverageRun.ps1",{"path":120,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":121,"sourceHtmlUrl":122},"scripts\u002FStep4-Restore-Payload.ps1",4438,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002FStep4-Restore-Payload.ps1",{"path":124,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":125,"sourceHtmlUrl":126},"scripts\u002FStep5-Get-ComponentCoverage.ps1",11734,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-coverage-calculation\u002Fscripts\u002FStep5-Get-ComponentCoverage.ps1",[128,136,165,189,205],{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":135},"01M7B9P8EXVVVKPMVJXWAFFF28","analyze-session","Opens a WinUI Profiler session file (.sqlite) and answers questions about a WinUI 3 app's performance from it with the winui-profiler tools: how the launch went, UI-thread ticks and slow ticks, regions of interest (navigations, flyouts and dialogs opening, focus changes), and the UI elements and composition visuals the events mention. Use it when someone asks why a WinUI app is slow to start or draws slowly, what a tick did, what happened around a navigation or to an element, or what a session holds, and for \u002Fwinui-profiler:analyze-session [session.sqlite | folder].","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002Ftools\u002FWinUIProfiler\u002Fskills\u002Fanalyze-session\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":146,"publishedAt":49},"01M6WZSNKGE3MCZSF9DQXZYYS9","test-suite-setup","Complete end-to-end setup and execution of the WinUI3 test suite locally. Delegates building to the build skill, then handles test payload creation, machine setup, and running all tests.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002Fsrc\u002F.github\u002Fskills\u002Ftest-suite-setup\u002FSKILL.md",[142,145],{"categoryNo":143,"categoryName":144,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164],"test suite setup","test suite","suite","test","setup","execution","winui3","machine setup","tests","delegates","build","build skill","creation","end","payload","running","complete","machine",{"skillNo":166,"name":167,"nameZh":6,"description":168,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":49},"01M6WZSH72TCPB5XBFYGAV8PXP","bt-build","Fast incremental C++\u002FMSBuild builds using bt. Use when the user wants to compile, build, check what's dirty, or query build dependencies in a repo that has .vcxproj files. Prefer bt over invoking MSBuild directly for inner-loop source changes (.cpp, .h, .idl, .xaml, .appxmanifest).","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002Fsrc\u002F.github\u002Fskills\u002Fbt-build\u002FSKILL.md",[],[172,157,173,174,175,176,177,47,178,179,180,181,182,183,43,184,185,186,187,188],"bt build","bt","query","files","check","changes","cpp","loop","msbuild","use","shell","compile","c++","inner-loop","for","inner","repo",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":196,"publishedAt":49},"01M6WZSBKKYWVMMR5W8ZEWF3CP","test-on-vm","EXPERIMENTAL. Run locally built WinUI interaction tests on a Hyper-V VM through PowerShell Direct. Use when asked to run WinUI tests on a local VM.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Ftest-on-vm\u002FSKILL.md",[195],{"categoryNo":143,"categoryName":144,"taxonomyType":21,"taxonomyTypeDesc":22},[150,197,198,38,199,200,155,181,47,201,202,203,204],"test on vm","vm","winui","powershell","interaction","run","direct","hyper",{"skillNo":206,"name":207,"nameZh":6,"description":208,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":209,"categories":210,"keywords":215,"publishedAt":49},"01M6WZS8FC8VE4M3V4W8N299Z8","code-review","Review changes in microsoft\u002Fmicrosoft-ui-xaml. Use when reviewing code or pull requests in this repository.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fmicrosoft-ui-xaml\u002Fblob\u002Fmain\u002F.github\u002Fskills\u002Fcode-review\u002FSKILL.md",[211,214],{"categoryNo":212,"categoryName":213,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},[216,217,29,218,43,181,219,47,220,177,221,222,9,223,40],"code review","review","pull","reviewing code","pull requests","requests","review changes","repository"]