[#MVU] Updating model crashes on net8.0-windows10.0.19041 but works fine on net8.0-desktop #2394
-
I have created very simple app that presents a list of Items in an Model: internal record Item(string Text, Brush Brush);
internal partial record MainPageModel
{
public IListState<Item> Items => ListState<Item>.Value(this, () =>
[
new Item("A", new SolidColorBrush(Colors.DeepSkyBlue)),
new Item("B", new SolidColorBrush(Colors.DarkOrchid)),
new Item("C", new SolidColorBrush(Colors.DarkOrange)),
]);
public async ValueTask AddItem()
{
await Items.Update(items => items.Add(GetRandomItem()), CancellationToken.None).ConfigureAwait(true); // crashes
}
} View: new ItemsRepeater()
.ItemsSource(() => vm.Items)
.Layout(new StackLayout())
.ItemTemplate<Item>(item => GetItemView(item)),
new Button()
.Content("Add item")
.Command(() => vm.AddItem)
private static TextBlock GetItemView(Item item) => new TextBlock()
.Text(() => item.Text)
.Foreground(() => item.Brush); Note that the App crashes differently cross many executions which suggests some concurrency issue. 09:12:57:390 Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.CoreLib.dll |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
cc: @dr1rrb |
Beta Was this translation helpful? Give feedback.
Let's track in #2455.