[C# Markup] Command executes on a background thread #2618
Labels
kind/bug
Something isn't working
project/csharp-markup
triage/untriaged
Indicates an issue requires triaging or verification.
Current behavior
Not showing any ContentDialog created from MmainModel using xamlRootProvider thats xamlRoot was set while the Page Loaded Event
Same Behaviour if you try to do the call from a xaml Markup App > MainModel
place the in this case async void (see video in the uno reference to ContentDialog which uses the Click event) in the mainPage
xaml.cs codebehind and you will have no problem, so in my opinion its defintly a mvux issue from related to the ViewModel.
Already checked:
xamlRoot is not null at this time
My calling code:
Task Code in MainModel:
DialogResult Property from Task content is in MainModel:
Relevant things we discovered so far:
the SynchronisationContext is suddenly null if you call the task in the model! No reason for that found until now.
using
navigator attempt was written by @mikernet
Expected behavior
In my opinion that should be all fine and working, but somehow it is throwing this exception
How to reproduce it (as minimally and precisely as possible)
Repo link:
https://github.com/DevTKSS/MyUnoApp.git
Reproduce it this way:
run it in debug mode (tested targets so far: Andoid Emulator, Skia Desktop, Wasm)
set a breakpoint on the start of the task on the mainModel (can be done before starting debug)
click on the "Go Right" Button
if it breaks step throught with F11
at some point while stepping throught the await dialog.ShowAsync(); in the binding view model it will throw the exception because it thinks we are not in the ui thread, while we never left it.
Workaround
use xaml markup or mvvm
Works on UWP/WinUI
No
Environment
Uno.UI / Uno.UI.WebAssembly / Uno.UI.Skia, Uno.WinUI / Uno.WinUI.WebAssembly / Uno.WinUI.Skia
NuGet package version(s)
just the one uno-check installed by default
Affected platforms
WebAssembly, Android, Skia (WPF), Skia (GTK)
IDE
Visual Studio 2022
IDE version
Microsoft Visual Studio Community 2022 Version 17.11.5 VisualStudio.17.Release/17.11.5+35327.3 Microsoft .NET Framework Version 4.8.09032
Relevant plugins
No response
Anything else we need to know?
Possibly related to the mvux pattern thing, so maybe a mvux issue?
unoplatform/uno#18598 (comment)
Seems to not happen in mvvm
The text was updated successfully, but these errors were encountered: