Skip to content

Fix CmdPal_DockConfiguration telemetry event never firing#47028

Open
niels9001 wants to merge 1 commit intomainfrom
nielslaute/fix-dock-telemetry-race
Open

Fix CmdPal_DockConfiguration telemetry event never firing#47028
niels9001 wants to merge 1 commit intomainfrom
nielslaute/fix-dock-telemetry-race

Conversation

@niels9001
Copy link
Copy Markdown
Collaborator

Bug

The \CmdPal_DockConfiguration\ telemetry event is never received in the data pipeline.

Root Cause

\DockViewModel\ fires a \TelemetryDockConfigurationMessage\ via \WeakReferenceMessenger\ in its constructor. However, \TelemetryForwarder\ — the recipient that forwards this to \PowerToysTelemetry\ — is registered as a lazy DI singleton (\ITelemetryService). If nothing has resolved \ITelemetryService\ before \DockViewModel\ is constructed, \TelemetryForwarder\ doesn't exist yet and the message is silently dropped.

Fix

Add \ITelemetryService\ as a constructor dependency of \DockViewModel. DI is forced to construct \TelemetryForwarder\ (and register its message listeners) before \DockViewModel's constructor runs.

Changes

File Change
\DockViewModel.cs\ Add \ITelemetryService\ constructor parameter to ensure listener registration order

DockViewModel.EmitDockConfiguration() fires a TelemetryDockConfigurationMessage
in its constructor, but TelemetryForwarder (which listens for that message) is
lazily constructed by DI and may not exist yet. WeakReferenceMessenger silently
drops messages with no registered recipient.

Fix: Add ITelemetryService as a constructor dependency of DockViewModel. This
forces DI to resolve TelemetryForwarder first, ensuring its message listeners
are registered before EmitDockConfiguration() fires.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@michaeljolley michaeljolley added the Product-Command Palette Refers to the Command Palette utility label Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-Command Palette Refers to the Command Palette utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants