xamarin/Xamarin.Forms

Crash when calling ChangeCanExecute() from non-UI thread

开放

#5,679 创建于 2019年3月25日

 (2 条评论) (0 个反应) (0 位负责人)C# (1,926 个派生)batch import
e/5 :clock5:help wantedi/highinactivet/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Description

App crashes when running async method which triggers ChangeCanExecute(). I think this should the responsibility of the renderers to trigger any visual updates on the UI thread. The workaround for this problem is to wrap all ChangeCanExecute() in Device.BeginInvokeOnMainThread()

Steps to Reproduce

Run async methods which triggers ChangeCanExecute(). You can i.e. create a button with async Command which changes one of the binding property and this binding property raise ChangeCanExecute() in the setter.

Expected Behavior

App should not crash.

Actual Behavior

App crashes when running async method which triggers ChangeCanExecute(). The problem exists both on Android and iOS.

Basic Information

  • Version with issue: Xamarin Forms 3.6.0.264807
  • Last known good version:
  • IDE: Visual Studio 2017 15.9.4
  • Platform Target Frameworks:
    • iOS: 8.0
    • Android: 8.1

Reproduction Project

Here is a project with a repro:

App1.zip

贡献者指南