Repository navigation
Register standalone MSBuild telemetry for NGEN - #15410
Conversation
Register the private telemetry assembly in standalone x86 and x64 MSBuild application contexts so VS setup can generate matching native images. Document binding validation and end-to-end performance limitations. Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
The narrow metadata change follows existing registration patterns, has reported x64 runtime validation, and has no identified blocking issues.
No open issues 🎉
What changed in this PR
Registers standalone .NET Framework MSBuild’s private telemetry assembly for NGEN, addressing a native-image coverage gap without changing build behavior or telemetry lifecycle.
Changes:
- Adds x86 and amd64 executable application contexts with
Allarchitecture and priority 2. - Documents binding identity, runtime image-use verification, and why reduced JIT work alone does not prove an end-to-end speedup.
| File | Description |
|---|---|
src/Package/MSBuild.VSSetup/files.swr |
Adds telemetry NGEN registration metadata for standalone MSBuild. |
documentation/NETFramework-NGEN.md |
Explains telemetry registration requirements and validation caveats. |
Review effort: Balanced
There was a problem hiding this comment.
✅ 24/24 dimensions clean — no findings.
The setup metadata follows existing application-context NGEN patterns, and the documentation accurately scopes the demonstrated validation and performance caveats.
Warning
Firewall blocked 8 domains
The following domains were blocked by the firewall during workflow execution:
api.github.comapi.nuget.orggithub.comlearn.microsoft.compatchdiff.githubusercontent.comraw.githubusercontent.comwww.bing.comwww.google.com
[!TIP]
api.github.com is blocked because GitHub API access uses the built-in GitHub tools by default. Instead of adding api.github.com to network.allowed, use tools.github.mode: gh-proxy for direct pre-authenticated GitHub CLI access without requiring network access to api.github.com:
tools:
github:
mode: gh-proxySee GitHub Tools for more information on gh-proxy mode.
To allow these domains, add them to the network.allowed list in your workflow frontmatter:
network:
allowed:
- defaults
- "api.github.com"
- "api.nuget.org"
- "github.com"
- "learn.microsoft.com"
- "patchdiff.githubusercontent.com"
- "raw.githubusercontent.com"
- "www.bing.com"
- "www.google.com"See Network Configuration for more information.
Generated by Expert Code Review (on open) for #15410 · copilot · gpt56 · 830.8 AIC · ⌖ 0.522 AIC · ⊞ 20.8K
|
extracted from checked in docs rationale and principles for this change in telemetry ngen: |
|
/backport to vs18.13 |
|
Started backporting to |
Related issue(s):
DevDiv bug 3083415. This addresses a demonstrated NGEN coverage gap; it resolves ~half of the regression, the rest is real work by setting up telemetry and sending data correctly in the scenario.
Run Evidence
improves the regressed scenario
https://devdiv.visualstudio.com/DevDiv/_git/VS/pullrequest/799933
Context
Standalone .NET Framework MSBuild ships a private
Microsoft.VisualStudio.Telemetry.dll, but its VS setup entry does not register that DLL for NGEN. Registration of the core MSBuild assemblies is insufficient because setup uses/NoDependencies. A native image for another telemetry build cannot cover this copy merely because both assemblies retain the same assembly version.Fresh MSBuild processes consequently JIT substantial telemetry SDK code. Local CLR Binding/Fusion diagnostics confirm a signature mismatch followed by "No matching native image found" in the default load context, rather than a LoadFrom-context failure.
Changes Made
Compatibility
VS setup metadata and documentation only. No product DLL bytes, telemetry consent, event collection, session lifecycle, shutdown budget, diagnostics, public APIs, or build semantics change. The CLR retains its normal native-image validation and IL/JIT fallback. No ChangeWave is needed for this performance-only registration correction.
Testing
.\build.cmd -msbuildEngine vs -c Release -v quiet -bl— passed, zero warnings and zero errors. The full generatedMicrosoft.Build.vsixcontains the intended NGEN application contexts,Allarchitecture, and priority 2. Its telemetry payload SHA-256 matches the installed DLL used for the runtime experiment.Run-Elevated.cmd(local diagnostic harness, not part of this PR) — passed: actual installed x64 VS MSBuild, real C++/NMake imports, and the recorded invalid-configuration echo fallback; 15 fresh-process measurements in each of the before/registered/restored states. Separate PID-filtered Binding/Fusion and loader/JIT captures lost zero events. The observer and ETW controller were not used in timed builds.python analyze_proof.py(local analysis harness, not part of this PR) — passed: deterministic raw-data accounting, all 75 fixture hashes unchanged, and successful telemetry save in every measured build. The experimental registration was removed, and an independent exact-file NGEN query confirmed restoration.Fusion explicitly reports "Bind to native image succeeded" after registration, and the CLR ModuleLoad event confirms the matching native path. All 45 remaining SDK JIT events in that diagnostic are runtime-generated methods.
Performance caveat: the save-excluded component improves by 106–120 ms, but this is arithmetic subtraction, not an isolated startup measurement. Variable save/disposal waits obscure the total benefit: the initial before/after mean changes by only 7.1 ms, with uncertainty spanning zero. Ordered phases, warm filesystem caches, and the inherited elevated token limit extrapolation. This is not a remeasurement of the original cold VS scenario or proof of recovery of its 489-ms regression.
Runtime image acceptance was checked on x64 only. x86/ARM64 runtime validation, the full unit test suite, and a fresh complete VS insertion/perf-system run were not performed.
Dependencies and Follow-up
Use the upstream experimental branch
exp/janprovaznik/telemetry-ngenfor downstream VS insertion and the original cold perf-system scenario. Setup must process the new registration metadata before measuring. Keep shutdown-policy/data-retention changes separate; this PR does not introduce that tradeoff.