You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
Bug report (I searched for similar issues and did not find one)
Current behavior
When accessing CoreApplication.Views in a UWP control that is inside a WindowsXamlHost in a WPF App, the CoreApplication.Views[0].Dispatcher property throws an Exception. When hosting the same control in a vanilla UWP App, the property can be accessed.
Expected behavior
Accessing CoreApplication.Views[0].Dispatcher should return the correct CoreDispatcher in both the mentioned cases.
Minimal reproduction of the problem with instructions
see https://github.com/jasonwurzel/XamlIslandDispatcherProblem for a repo. Start either ControlPlaygroundPackage (WPF - XamlIsland - Uwp) or UwpApp (UWP App) (in Debug - x64). Starting UwpApp results in no exception, starting the WPF App results in an exception when CoreApplication.Views[0].Dispatcher is accessed.
Min Windows version is 1903
dotnet core sdk 3.0.100-preview5-011568 is expected to be present
Environment
Nuget Package(s):
- Microsoft.Toolkit.Wpf.UI.XamlHost 6.0.0-preview7.1
- Microsoft.Toolkit.Uwp.UI.Controls 5.1.1
- Microsoft.Toolkit.Uwp 5.1.1
- Microsoft.NETCore.App 3.0.0-preview7-27912-14
Package Version(s):
Windows 10 Build Number:
- Windows 1903 18362
App min and target version:
- Windows 1903 18362
Device form factor:
- Desktop
Visual Studio
- 2019 (version: 16.2.3)
The text was updated successfully, but these errors were encountered:
jasonwurzel
changed the title
Accessing CoreApplication.Views[0].Dispatcher throws
Accessing CoreApplication.Views[0].Dispatcher throws in XamlIsland
Sep 3, 2019
Preview 5 is not recent, but the issue you are hitting has nothing to do with it. This is by design.
As you can see in your sample, using Window.Current.Dispatcher works. This should be used instead.
UWP controls running in a Xaml Islands Context are not supposed to work as-is. Minor tweaks might be required, like setting the XamlRoot of a popup to be the XamlIslands one, or Accessing the Disposer with that other pattern. We are working on the documentation, and all the workaround you did in your sample to reference a UWP class library from the WPF project should not be required. A simplified set of instructions to reference everything properly can be found here: #159 (comment)
Hi @azchohfi ,
thank you for the hint using the simplified instructions. That looks like a sane route to go.
My issue above stems from a change that was made in RxUI , so I'm a bit detached from any control there. But I guess we'll find a workaround/fix.
I'm submitting a...
Current behavior
When accessing CoreApplication.Views in a UWP control that is inside a WindowsXamlHost in a WPF App, the CoreApplication.Views[0].Dispatcher property throws an Exception. When hosting the same control in a vanilla UWP App, the property can be accessed.
Expected behavior
Accessing CoreApplication.Views[0].Dispatcher should return the correct CoreDispatcher in both the mentioned cases.
Minimal reproduction of the problem with instructions
see https://github.com/jasonwurzel/XamlIslandDispatcherProblem for a repo. Start either ControlPlaygroundPackage (WPF - XamlIsland - Uwp) or UwpApp (UWP App) (in Debug - x64). Starting UwpApp results in no exception, starting the WPF App results in an exception when CoreApplication.Views[0].Dispatcher is accessed.
Environment
The text was updated successfully, but these errors were encountered: