LoginSignup
0
0

More than 5 years have passed since last update.

Xamarin.FormsでFunc<Task>を実行するとNotSupportedExceptionが発生する件

Last updated at Posted at 2017-08-26

Xamarin&Prismで以下のコードでNotSupportedExceptionが発生

/// <summary>
/// アクション実行
/// </summary>
/// <param name="action"></param>
/// <param name="errorAction"></param>
public static async Task ExecuteAsync(IPageDialogService pageDialogService,
Func<Task> action,
Func<Task> successAction,
Func<Exception, Task> errorAction)
{
    try
    {
        await action();

        if (successAction != null)
        {
            await successAction();
        }
    }
    catch (BusinessApplicationException ex1) when (ex1 is ApiTimeoutException)
    {
        await ShowDialogTimeoutAsync(pageDialogService);

        await errorAction?.Invoke(ex1);
    }
    catch (BusinessSystemException ex2)
    {
        // TODO:継続不可能例外
        throw;
    }
    catch (Exception ex3)
    {
        throw;
    }
}

Visual Studio 2017 15.3.2で解消してることを確認

ちなみにAndroid限定らしい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0