Click or drag to resize

AsyncRelayCommandTParamExecute Method (TParam)

Executes the AsyncRelayCommand on the current command target.

Namespace:  BionicCode.Utilities.Net.Core.Wpf.Generic
Assembly:  BionicCode.Utilities.Net.Core.Wpf (in BionicCode.Utilities.Net.Core.Wpf.dll) Version: 1.0.2
Syntax
public void Execute(
	TParam parameter
)

Parameters

parameter
Type: TParam
The command parameter.

Implements

IAsyncRelayCommandTParamExecute(TParam)
Remarks
When this method is called although an asynchronous execute delegate was registered, this asynchronous delegate will be executed asynchronously, but since the Execute(TParam) does not return a Task and is declared as async void, the execution is not awaitable and more important exceptions from an async void method can’t be caught with catch!

Async void methods have different error-handling semantics. When an exception is thrown out of an async Task or async Task<T> method, that exception is captured and placed on the Task object. With async void methods, there is no Task object, so any exceptions thrown out of an async void method will be raised directly on the SynchronizationContext that was active when the async void method started. Exceptions thrown from async void methods can’t be caught naturally.

In such a scenario it is highly recommended to always call ExecuteAsync(TParam) instead.

See Also
https://github.com/BionicCode/BionicCode.Net/blob/master/README.md