Add sample usage and crash telemetry - #2235
Draft
Morten Nielsen (dotMorten) wants to merge 4 commits into
Draft
Morten Nielsen (dotMorten) wants to merge 4 commits into
Morten Nielsen (dotMorten) wants to merge 4 commits into
Conversation
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.
Description
Adds opt-out telemetry for WinUI Gallery sample usage and crash diagnostics.
Production activation still requires the approved provider group, privacy product ID, crash privacy tags, event ownership/schema registration, and privacy review.
Motivation and Context
Sample page views provide an aggregate signal about which Windows App SDK controls and features developers are most interested in. Crash diagnostics add the active sample context needed to identify unstable samples without collecting exception messages or arbitrary navigation data.
How Has This Been Tested?
dotnet test tests\WinUIGallery.UnitTests\WinUIGallery.UnitTests.csprojdotnet build WinUIGallery\WinUIGallery.csproj --configuration Debug --no-restore /p:Platform=x64dotnet build WinUIGallery\WinUIGallery.csproj --configuration Release --no-restore /p:Platform=x64 /p:EnableTelemetry=true /p:TelemetryProviderGroupGuid=11111111-1111-1111-1111-111111111111 /p:TelemetryPrivacyProductId=1 /p:TelemetryCrashPrivacyTags=1Screenshots (if appropriate):
The Settings page now includes a Privacy section with the Optional diagnostic data toggle and public telemetry

disclosure link.
Types of changes
Privacy overview
The proposed collection has two events with one shared purpose: understand which WinUI samples are useful and diagnose failures associated with those samples.
Proposed event contracts
Sample page view
PageIdUniqueIdfrom the sample catalog bundled with the appAppVersionPartA_PrivacyProductPartA_PrivTagsThe event is emitted only after successful root-frame navigation to
ItemPage. The navigation parameter must match exactly one catalog item. Null, non-string, unknown, duplicate, category, Home, All Controls, Settings, failed, and embedded-frame navigation values are rejected without logging the rejected value.Each successful eligible visit is a separate event. Revisits and back/forward visits are intentionally counted. The event does not measure dwell time or retain navigation history.
Managed unhandled exception
CrashTimeUtcSampleIdExceptionTypeHResultException.HResultStackTraceException.StackTrace, or empty when unavailableAppVersionPartA_PrivacyProductPartA_PrivTagsSampleIdis updated only after successful root-frame navigation and is cleared on every non-sample navigation. It is therefore a single current context value, not a navigation-history field.This event covers exceptions observed by
Application.UnhandledException. It does not claim to capture native crashes, fail-fast termination, stack overflow, process termination before the handler runs, or every background-thread failure.Field-level safeguards
HResultis collected instead of the potentially user-containing exception message.Consent and regional safeguards
The privacy-sensitive region decision uses the Windows-configured geographic region, not IP geolocation, and currently includes:
Local crash-record safeguards
ApplicationData.LocalFolder; the app does not copy it to another local location.Build and distribution safeguards
EnableTelemetry=true.Information explicitly excluded