-
Notifications
You must be signed in to change notification settings - Fork 712
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
Comments
@Berkunath Dispatcher and CoreDisptacher are null in the Preview 4. You should use DispatcherQueue instead. |
@marb2000 is there a reason why Dispatcher and CoreDispatcher are null? This seems to be an unnecessary breaking change for existing UWP style code? |
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. |
Why Dispatcher was not marked as Deprecated? I spent a lot of time until find this issue |
Here is what it looks like now: _ = DispatcherQueue.TryEnqueue(() => DoYourThing()); |
It could at least be mentioned in the Documentation. |
This, and other similar APIs, are outlined here: Windows Runtime APIs not supported in desktop apps |
#1 That link is broken |
After an attempt to upgrade a 4.8 UWP app to NET9 I got comments in the code:
That link at least shows some details (still working on it...) But an "obsolete" warning would have been more helpful. |
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]
The text was updated successfully, but these errors were encountered: