Repository navigation
fix(telemetry): Re-enable XAML generator telemetry (backport #25846) - #25850
Merged
agneszitte merged 4 commits intoNov 2, 2026
Merged
Conversation
Since 6.7 the generator created its telemetry client only when the build had opted out, so no build sent generate-xaml events. It now creates one only when the build hasn't opted out, isn't a design-time build and isn't running in the browser. InitTelemetry runs before _isDesignTimeBuild is set, so the design-time check now reads the context directly. The generator tests opt out through UNO_PLATFORM_TELEMETRY_OPTOUT, so running them doesn't send build telemetry. Related to unoplatform/uno-private#2477 Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 9d47558) # Conflicts: # src/SourceGenerators/Uno.UI.SourceGenerators.Tests/XamlCodeGeneratorTests/Given_XamlTelemetry.cs
The documented UNO_PLATFORM_TELEMETRY_OPTOUT=1 didn't stop the generator: the telemetry library parses the variable with bool.TryParse, so only "true" worked, and a reused compiler server can predate the variable. The generator now reads it through the build and creates no client when it's "1" or "true". An MSBuild opt-out also wins over UNO_PLATFORM_TELEMETRY_OPTOUT=false now, since an opted-out build has no client to enable. Related to unoplatform/uno-private#2477 Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit d080127)
- The dev server's hot-reload workspace flags its builds with UnoIsHotReloadHost; the generator now creates no client for them. That workspace already evaluates as a design-time build, so this keeps hot reload silent if that ever changes. - Replace the CreateTelemetry factory with an IsTelemetryDisabled predicate. - Set _isDesignTimeBuild before InitTelemetry, and drop the Track* checks that a design-time build no longer reaches. - Comment the environment-variable property and the test hook. Related to unoplatform/uno-private#2477 Co-Authored-By: Claude Opus 5.5 <[email protected]> (cherry picked from commit 2089192)
Contributor
Author
|
Cherry-pick of 9d47558 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
2 of 5 tasks
Given_XamlTelemetry doesn't exist on 6.7, so the cherry-pick brought in master's whole file, including the GetUnoRuntime tests. 6.7 has no GetUnoRuntime, so only the telemetry gate tests are kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
rajamatt
enabled auto-merge
October 30, 2026 19:31
rajamatt
approved these changes
Oct 30, 2026
rajamatt
disabled auto-merge
October 30, 2026 20:57
Contributor
Author
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
Jen-Uno
enabled auto-merge
November 2, 2026 15:20
kazo0
disabled auto-merge
November 2, 2026 15:39
kazo0
approved these changes
Nov 2, 2026
Member
|
@Mergifyio backport servicing/6.8 |
Contributor
Author
✅ Backports have been createdDetails
|
Merged
2 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub Issue: related to unoplatform/uno-private#2477 (kept open until the
release/stable/6.7backport ships)PR Type:
🐞 Bugfix
What changed? 🚀
Since 6.7, the XAML generator sends no build telemetry (
uno/generation/generate-xaml,-done,-failed), whether or not the build opted out. 93e435f put the client behindisTelemetryOptout() is true. ButUno.DevTools.TelemetryreadsenabledProvideras the opt-out flag (Enabled = !enabledProvider()). So an opted-out build got a disabled client, and every other build got none.The generator now creates a client only when
IsTelemetryDisabledis false. It returns true in five cases:UnoPlatformTelemetryOptOutis1ortrue. This is the root-cause fix.UNO_PLATFORM_TELEMETRY_OPTOUTis1ortrue, read through the build as aCompilerVisibleProperty.bool.TryParse, so onlytrueworked, and 6.6 sent telemetry for users who had set1._isDesignTimeBuildused to be read before it was set, so every design-time build, 6.6 included, started an enabled client, even though theTrack*methods then skipped sending. It's now set first.UnoIsHotReloadHost. The dev server's hot-reload workspace already evaluates as design-time, becauseMSBuildWorkspacedefaults toDesignTimeBuild=trueandBuildingProject=false. The explicit check keeps hot reload silent if that changes.Flushblocks onTask.Wait, which most likely broke the in-browser build that 93e435f fixed.The generator test assembly sets
UNO_PLATFORM_TELEMETRY_OPTOUT=truein an[AssemblyInitialize]. The test harness doesn't pass that variable as a build property, so the generator's own check never sees it. The clients these tests create stay disabled through the library instead.Builds that haven't opted out send the same events as 6.6. Because an opted-out build has no client,
UNO_PLATFORM_TELEMETRY_OPTOUT=falsecan no longer re-enable a build that setUnoPlatformTelemetryOptOut.Reviewer's guide
XamlCodeGeneration.Telemetry.cs: the gate (InitTelemetry,IsTelemetryDisabled).XamlCodeGeneration.cs:_isDesignTimeBuildmoved ahead ofInitTelemetry.Uno.UI.SourceGenerators.props: two newCompilerVisiblePropertyentries.Given_XamlTelemetryholds the tests.AssemlyInfo.csholds the test-run opt-out.Validation
Given_XamlTelemetrycoversIsTelemetryDisabled, not howInitTelemetrywires it up.true,True,1), opt-outs by the variable (true,TRUE,1, including with the property set tofalse), design-time builds and hot-reload builds."",falseor0in either place, andUnoIsHotReloadHost=False.Uno.UI.SourceGenerators.propsgetsbuild_property.UNO_PLATFORM_TELEMETRY_OPTOUTandbuild_property.UnoIsHotReloadHost. A design-time compile writesDesignTimeBuild = trueandBuildingProject = falseinto the generator's config.Uno.UI.SourceGenerators.Testsrun: 222 passed, 7 skipped, 403 failed, all withUnable to find Uno.UI.dllbecauseUno.UIwasn't built. That run was on the first commit and hasn't been repeated, and it was built againstnet10.0locally because I don't have a .NET 11 SDK. CI runs the full suite.Open questions before merge or backport
Follow-up
release/stable/6.7after merge. That branch usesUno.DevTools.Telemetry1.3.3 and has noGiven_XamlTelemetry, so the backport needs adapting.servicing/6.8has the same check.Uno.DevTools.Telemetry:1and0for the variable;Dispose's drain, which can block a build for up to about 100s on a network that silently drops traffic (as in 6.6);Disposerace that leaves a channel undisposed in long-lived processes;TelemetryEnvironment's docs that a host may opt out before creating a client.PR Checklist ✅
Given_XamlTelemetrydoc/articles/uno-toolchain-telemetry.mdalready documents1ortrue, and the generator now matches itScreenshots Compare Test Runresults.🤖 Generated with Claude Code
This is an automatic backport of pull request #25846 done by [Mergify](https://mergify.com).