question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Preview 4] Dispatcher properties are now null

See original GitHub issue

Describe 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

  1. Build a Preview 4 WinUI app.
  2. Inspect the Dispatcher property on any control.

Expected behavior Dispatchers should not be null.

Screenshots

image

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:open
  • Created 3 years ago
  • Reactions:7
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
MikeHillbergcommented, Feb 16, 2021

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.

3reactions
crramirezcommented, Feb 12, 2021

Yesterday I had to change to .DispatcherQueue.TryEnqueue(…). I confirm that this workaround works

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found