microsoft / microsoft-ui-xaml

WinUI: a modern UI framework with a rich set of controls and styles to build dynamic and high-performing Windows applications.
MIT License
6.38k stars 683 forks source link

Remove DependencyObject.Dispatcher and Window.Dispatcher #6027

Open dotMorten opened 3 years ago

dotMorten commented 3 years ago

Describe the bug

The Dispatcher property has been non-functional for a while now (always returns null), and instead we're told to change our code and use DispatcherQueue.

It's extremely error prone to still have this around - especially when trying to port a UWP or WPF app over, and we don't get compile time errors, but keep crashing with null reference exceptions instead. Could you please just remove it? (or even better keep it but replace it with the dispatcher queue so we don't have to change all our ported code just to use another type that serves the exact same purpose).

Steps to reproduce the bug

Debug.Assert(myElement.Dispatcher != null);
Debug.Assert(window.Dispatcher != null);

Expected behavior No non-functional APIs present.

Screenshots image

Version Info

NuGet package version: [Microsoft.WindowsAppSDK 1.0.0-preview1]

Windows 10 version Saw the problem?
Insider Build (xxxxx)
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)

Additional context

BenJKuhn commented 3 years ago

Opened a corresponding internal work item: 36612456

StephenLPeters commented 3 years ago

@MikeHillberg @bpulliam @codendone FYI

dotMorten commented 2 years ago

Since this never got cleaned up before shipping, could you at least mark them Obsolete and hide them from Intellisense? Then we'd at least be warned about using stuff that can't be used.