Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

System.InvalidProgramException: Invalid IL code calling an async delegate from an event

$
0
0

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?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>