-
Notifications
You must be signed in to change notification settings - Fork 309
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.