microsoft / microsoft/WindowsAppSDK-Samples

[Bug Report] Weather Widget Sample: Pinned widget shows "Pin" action after restart and creates a duplicate empty instance

Open
#584 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
1k
Forks
335
Avg merge
5d 1h
Merged PRs (30d)
8

Description

Description I have successfully built, packaged, and deployed the C# Weather Widget sample from this repository. However, I am experiencing an issue with the widget's lifecycle state persistence.

When the widget is already pinned to the Widgets Board, and the system (or the Widgets process) is restarted, the existing widget instance incorrectly displays the "Pin" (add) button again in the header or options. Clicking this button results in the creation of a duplicate widget instance that renders as an empty window.

Steps to Reproduce

Build and deploy the Weather Widget sample.

Open the Windows 11 Widgets Board.

Add (Pin) the Weather Widget to the board. It renders correctly.

Restart the computer (or restart the Widgets.exe process via Task Manager).

Open the Widgets Board again.

Observe the existing Weather Widget.

Click the "Pin" button (or "Add widget" if visible) associated with the provider.

Observed Behavior The system allows pinning the widget again despite it already being present. This action creates a second instance of the widget which fails to load content (appears as an empty/blank window).

Expected Behavior The system (or the Provider) should recognize that the widget is already pinned. The "Pin" action should not duplicate the widget in this manner, or the Provider should correctly handle the restoration of the existing WidgetId without creating a ghost instance.

Environment

Windows 11 Build: [22621.4317]

Visual Studio 2026

Windows App SDK Version: [1,5]

Question Is this a known issue with how the sample handles WidgetContext or persistent state in the WidgetProvider.cs? Any advice on how to fix this duplication logic would be appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with WidgetProvider.cs and reproduce the Weather Widget lifecycle described: pin the widget, restart Windows or Widgets.exe, and inspect the restored instance. Trace how WidgetContext and persistent WidgetId state are handled; done means an already-pinned widget no longer exposes a duplicate Pin action or creates a blank second instance.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.