Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dispatcher is null in WinUI Desktop in WinUI 3 Preview 4 #4219

Closed
Berkunath opened this issue Feb 17, 2021 · 7 comments
Closed

Dispatcher is null in WinUI Desktop in WinUI 3 Preview 4 #4219

Berkunath opened this issue Feb 17, 2021 · 7 comments
Assignees
Labels
appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps product-winui3 WinUI 3 issues team-Reach Issue for the Reach team version-winui3preview4 WinUI 3 Preview 4 issues

Comments

@Berkunath
Copy link

Berkunath commented Feb 17, 2021

Dispatcher of Page and other UI elements are return null in WinUI Desktop after upgrade of WinUI 3 Preview 4. We have to run async using Dispatcher. But Dispatcher returns null in WinUI Desktop but WinUI UWP returns proper value for Dispatcher. It works fine in WinUI 3 Preview3

await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { // My Action here });

Expected behavior
Dispatcher should not be null or sugestion to Runasync

NuGet package version:

[Microsoft.WinUI 3.0.0-preview4.210210.4]

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 17, 2021
@Berkunath Berkunath changed the title Dispatcher is null in WinUI Desktop Dispatcher is null in WinUI Desktop in WinUI 3 Preview 4 Feb 17, 2021
@marb2000 marb2000 self-assigned this Feb 17, 2021
@marb2000
Copy link
Contributor

@Berkunath Dispatcher and CoreDisptacher are null in the Preview 4. You should use DispatcherQueue instead.
Here you can find a demo that uses it.

@ghost ghost removed the needs-triage Issue needs to be triaged by the area owners label Feb 17, 2021
@marb2000 marb2000 added appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps version-winui3preview4 WinUI 3 Preview 4 issues labels Feb 17, 2021
@nickrandolph
Copy link

@marb2000 is there a reason why Dispatcher and CoreDispatcher are null? This seems to be an unnecessary breaking change for existing UWP style code?

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label May 12, 2021
@StephenLPeters StephenLPeters added team-Reach Issue for the Reach team and removed needs-triage Issue needs to be triaged by the area owners labels May 14, 2021
@StephenLPeters
Copy link
Contributor

StephenLPeters commented May 14, 2021

Winui3 doesn't have a core window and Dispatcher and CoreDispather both relied on CoreWindow. Thus these APIs are no longer sufficient for the winui3 app model, DispatcherQueue is their replacement.

@krschau krschau added the product-winui3 WinUI 3 issues label Jul 14, 2021
@fiftin
Copy link

fiftin commented Sep 23, 2021

Why Dispatcher was not marked as Deprecated?

I spent a lot of time until find this issue

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Sep 23, 2021
@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Oct 7, 2021
@Slion
Copy link

Slion commented Feb 4, 2022

Here is what it looks like now:

_ = DispatcherQueue.TryEnqueue(() => DoYourThing());

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 4, 2022
@LokiMidgard
Copy link

It could at least be mentioned in the Documentation.

@ghost ghost removed the needs-triage Issue needs to be triaged by the area owners label Jun 16, 2022
@krschau
Copy link
Contributor

krschau commented Jun 16, 2022

This, and other similar APIs, are outlined here: Windows Runtime APIs not supported in desktop apps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
appModel-win32 Exclusive to WinUI 3 Win32 Desktop apps product-winui3 WinUI 3 issues team-Reach Issue for the Reach team version-winui3preview4 WinUI 3 Preview 4 issues
Projects
None yet
Development

No branches or pull requests

9 participants