Bug 47353

Summary: Mono.CSharp.MetadataImporter.set_IgnoreCompilerGeneratedField not found when running Cake on Mono 4.8
Product: [Mono] Class Libraries Reporter: Alexander Köplinger [MSFT] <alkpli>
Component: GeneralAssignee: Marek Safar <masafa>
Status: CLOSED FIXED    
Severity: normal CC: masafa, mohitk, mono-bugs+mono, saurabhd, shrutis
Priority: ---    
Version: 4.8.0 (C9)   
Target Milestone: 4.8.0 (C9)   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: Yes
Last known good build: 4.6 / C8

Description Alexander Köplinger [MSFT] 2016-11-18 14:00:57 UTC
Reported by https://github.com/cake-build/cake/issues/1368.

When running Cake on Mono 4.8 it fails with "Method 'Mono.CSharp.MetadataImporter.set_IgnoreCompilerGeneratedField' not found".

The issue is that they bundle an old Mono.CSharp.dll which gets loaded and we now try to set the property above from Microsoft.CSharp.dll which is only present in a newer version since https://github.com/mono/mono/commit/5da8cfe05df331723584997bb9bbc6ac961c12d4.

Resolution: stop bundling Mono.CSharp.dll or use a different assembly name.
Comment 1 Marek Safar 2016-12-12 16:39:15 UTC
Fixed in master and Mono 4.8
Comment 2 Saurabh 2017-02-02 08:52:49 UTC
I have tried to reproduce this Issue with Mono and XS 6.2 (Build 1505) using FastlaneLecture project from https://github.com/ghuntley/appstore-automation-with-fastlane but application getting build and deployed successfully on device and Simulator.

Application Output: https://gist.github.com/saurabh360/9b7fed28ba39f6719be49198c40e454f
Build Output: https://gist.github.com/saurabh360/fe675494f10a108c043f6c902e2fadf9

@Alexander/Marek, Could you please let me know how can I reproduce this Issue so that I can verify it?
Comment 3 Shruti 2017-02-07 06:34:32 UTC
@Marek, It would be great if you have a look comment2. We are looking for your valuable feedback, will help us to reproduce and verify this issue.

Comment 4 Marek Safar 2017-02-07 15:38:59 UTC
The simple way I can think of reproducing it is to create simple C# program which does some dynamic operation


dynamic d = 1;
Console.WriteLine (d + 2);

if you also reference Mono.CSharp nuget you should get execution error (this assumes nuget content is copied to bin folder)
Comment 5 Mohit Kheterpal 2017-02-07 16:47:35 UTC

To reproduce this issue I have created a console project of C# in XS and add the code that you have provided in comment 4,

using System;

namespace hghgh
	class MainClass
		public static void Main(string[] args)
			dynamic d = 1;
			Console.WriteLine(d + 2);

But it give build error with latest mono 4.8 and the mono that contains the issue however if I add Microsoft.CSharp in its Reference then it build successfully with both mono i.e. with Latest mono MonoFramework-MDK- and with MonoFramework-MDK-

I am not getting any difference, please let me know If I missed something to reproduce this issue?

Comment 6 Mohit Kheterpal 2017-02-07 16:49:02 UTC
Build output for comment 5 : https://gist.github.com/Mohit-Kheterpal/b0badf2fd3e8f4fadd69866845660a85
Comment 7 Marek Safar 2017-02-07 17:03:07 UTC
Did you add Mono.CSharp nuget? Can you attach your project?
Comment 9 Marek Safar 2017-02-08 10:38:34 UTC
I guess If you really want to reproduce you'll have to use cake-build steps to repro
Comment 10 Mohit Kheterpal 2017-02-08 13:16:19 UTC
I am not sure about the cake-build steps, I have searched it on google and find a Cake.Xamarin test sample from https://github.com/Redth/Cake.Xamarin and run this sample in XS using MonoFramework-MDK- and with MonoFramework-MDK- and I am getting same behaviour.  

I m not sure, I am in right direction to verify this issue.