Bug 15717 - Invalid IL code near generic EventArgs<T>
Summary: Invalid IL code near generic EventArgs<T>
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
Depends on:
Reported: 2013-10-25 16:43 UTC by Brendan Zagaeski (Xamarin Team, assistant)
Modified: 2014-01-24 12:30 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Brendan Zagaeski (Xamarin Team, assistant) 2013-10-25 16:43:44 UTC
Reported on behalf of a user.

## Question for repro

When compiled in Visual Studio 2012 on Windows -- no IL exception
When compiled in Xamarin Studio on OSX -- IL exception

If we provided "identical" DLLs from Windows and Mac, is there a chance they would be sufficient to diagnose this problem, or will you need an example source project?


## Summary

> System.InvalidProgramException: Invalid IL code in Retail.iOS.MainView:<Initialize>m__42 (object,Data.Models.EventArgs`1<bool>): IL_0008: stfld     0x040004a8
>  at SfdcUploader.OnSyncStateChanged (Boolean state) [0x00017] in /Users/_username_/Development/Sfdc/SfdcUploader.cs:38
>  at SfdcUploader.Start (Buzz.Data.Sfdc.SyncState inObj) [0x0029f] in //Users/_username_/Development/Sfdc/SfdcUploader.cs:176
>  at SfdcController+<SaveToQueue>c__AnonStorey5.<>m__D (System.Object a) [0x00045] in/Users/_username_/Development/Sfdc/SfdcController.cs:435

It occurs when this event is invoked:

public static event EventHandler<EventArgs<bool>> SyncStateChanged;

private static void OnSyncStateChanged (bool state)
    if (SyncStateChanged != null)
	SyncStateChanged(null, new EventArgs<bool>(state));

... which was invoked up the chain at:

ThreadPool.QueueUserWorkItem(a =>
	var pkg = new SyncState(Operations.SaveRoundTrip);
	pkg.IsRoundTripper = replyResult.isRoundTripper;
	pkg.FinishActionUpRoundTrip = TransportFinishedRoundTrip;

	pkg.ByPassTimeMinute = true;

## Version information
Mono 3.2.0 ((no/7c7fcc7)

Mac OS X 10.9.0
Xcode 5.0.1 (3335.23)

Xamarin.Android 4.8.3
Xamarin.iOS Version:
Xamarin Studio 4.0.13 (build 38)
Comment 2 Marek Safar 2013-10-26 06:57:51 UTC
The miscompiled code is in Retail.iOS.MainView:<Initialize>m__42 which is not attached.  Could you add it as well. Secondly, you are not running the latest Mono version, there has been fixed in that area meantime which could address this issue.
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2014-01-24 12:25:21 UTC
Sorry to have left this sitting around for so long. The users who reported this were unable to reproduce the problem after upgrading to Mono 3.2.3. I was waiting to hear back from them for final confirmation, but they haven't written back since October, so I think we're all set!

Comment 5 Marek Safar 2014-01-24 12:30:58 UTC