[Preview 4] Dispatcher properties are now null
See original GitHub issueDescribe the bug It appears that all dispatchers returned from UI Elements are now all null. This is a major breaking change from Preview 3 and any existing XAML apps you might want to port.
Steps to reproduce the bug
- Build a Preview 4 WinUI app.
- Inspect the
Dispatcher
property on any control.
Expected behavior Dispatchers should not be null.
Screenshots
Version Info
NuGet package version: [Microsoft.WinUI 3.0.0-preview4.210210.4]
Windows app type:
UWP | Win32 |
---|---|
Yes |
Windows 10 version | Saw the problem? |
---|---|
Insider Build (xxxxx) | |
October 2020 Update (19042) | |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | |
Xbox | |
Surface Hub | |
IoT |
Additional context
Workaround: Use .DispatcherQueue.TryEnqueue(...).
Issue Analytics
- State:
- Created 3 years ago
- Reactions:7
- Comments:15 (8 by maintainers)
Top Results From Across the Web
How can the Dispatcher-Property get null? - xaml
I have the strange case that the Dispatcher -property of a control, in my case a simple Button , gets null . This...
Read more >Null value returned when querying dispatcher properties ...
Symptom. The dispatcher ID returns the expected dispatcher value, but a null value is returned by the getValue() function for the dispatcher ......
Read more >C# 11.0 preview: parameter null checking
C# 11.0 has a new syntax, !!, which makes it easier to detect and reject null arguments. It is simple, but misunderstood.
Read more >Nullable reference types
This article provides an overview of nullable reference types. You'll learn how the feature provides safety against null reference ...
Read more >Object Reference Not Set to an Instance of an Object
This exception is thrown when you try to access a member—for instance, a method or a property—on a variable that currently holds a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry this change wasn’t announced. We’re updating documentation to explain the effects of the change in Preview4 to not create these key UWP types in Desktop, like CoreDispatcher and ApplicationView.
Using DispatcherQueue is the right way to queue to the UI thread.
Yesterday I had to change to .DispatcherQueue.TryEnqueue(…). I confirm that this workaround works