Skip to content

ICommand.CanExecuteChanged should handle the execution on the correct thread #4473

@trodent83

Description

@trodent83

NET Core Version: 5.0.201
Windows version: Windows 10 Entrprise 190
Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
**Problem description:
Currently the registration to the ICommand.CanExecuteChanged event doesn't consider that the triggering of the command state change can happen from a background thread and throws an InvalidOperationException.

Considering that the registration to the command even happens in the control it should ensure the execution of the refresh will happen on the thread of the control.

**Actual behavior: Exception is thrown when the CanExecuteChanged is called from not the Owner thread.

**Expected behavior: The state refresh should be executed without any problems

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions