Trying to hook up an event to an async delegate we are getting:
System.InvalidProgramException: Invalid IL code in XXXXXX.AppDelegate/c__AnonStorey6/c__async5:MoveNext (): IL_016e: callvirt 0x0a00003a
at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[c__async5] (XXXXX.c__async5& stateMachine) [0x0001b] in ...
The line in question is:-
initialViewController.Pushed += async (sender, e) => { ... }
Pushed
is an event exposed by the initialViewController, the event was triggered further down the stack by a button push.
Without the keyword 'async' the delegate is called just fine.
Any reason why a standard .NET event can't be connected to an async delegate like this?