Bug 28211

Summary: Getting "error MT3001: Could not AOT the assembly" When Building for Device
Product: [Mono] Compilers Reporter: Jimmy [MSFT] <jimmy.garrido>
Component: C#Assignee: Marek Safar <masafa>
Severity: normal CC: chris.house, dylan.kelly, masafa, mono-bugs+mono, mono-bugs+monotouch, sebastien, udhams, vargaz
Priority: Normal    
Version: 3.12.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Comment 2 Sebastien Pouliot 2015-03-19 16:27:51 UTC
@Jimmy an MT3001 error is the AOT compiler crashing while compiling an assembly. From the logs:

		* Assertion at ../../../../../mono/mono/mini/method-to-ir.c:3321, condition `method->is_inflated && mono_method_get_context (method)->method_inst' not met

Minimally we'll need the /Users/Christopher/Documents/Projects/G360/Global 360/ProtocolApp/Main/Ecolab.G360.ProtocolApp.iOS/obj/iPhone/Debug/mtouch-cache/Build/Ecolab.G360.ProtocolApp.Reporting.dll file to reproduce this (and ideally the whole project as there can be dependencies)
Comment 3 Christopher House 2015-03-19 17:13:37 UTC
Sebastien - I provided a repro project to Jimmy that contains the problem assembly.  He was meant to attach it to this case as a private attachment.  If it's not showing as a private attachment feel free to email me directly and I can provide it to you there.  Unfortunately as the code is proprietary, I can't attach it publicly.
Comment 4 Sebastien Pouliot 2015-03-19 17:18:55 UTC
@Christopher thanks! I missed it and only saw the logs (but was there).

@Zoltan using the attachment the crash still occurs in cycle 5

		Mono Ahead of Time compiler - compiling assembly /Users/poupou/Downloads/Archive-2/ReportingProject.Sample/obj/iPhone/Debug/mtouch-cache/64/Build/Ecolab.G360.ProtocolApp.Reporting.dll
		* Assertion at ../../../../../mono/mono/mini/method-to-ir.c:3440, condition `method->is_inflated && mono_method_get_context (method)->method_inst' not met
Comment 7 Zoltan Varga 2015-03-20 18:58:15 UTC
This looks like a compiler problem then, would it be possible to extract a test case from the source code ? Its also possible that the problem is already fixed in 4.0.
Comment 8 Sebastien Pouliot 2015-03-30 10:38:09 UTC
@Paola can you update your system mono to 4.0 and see if this is still an issue ?

If it's still result in an MT3001 error then please try to create a smaller test case out of the original sample.
Comment 9 Paola Villarreal 2015-03-31 16:02:45 UTC
Confirming bug, this still happens on mono 4.0. 

Working on test case. 


Xamarin Studio
Version 5.8.2 (build 7)
Installation UUID: 226bee58-de6e-4832-9b4c-85cdb95c4472
	Mono 4.0.0 ((detached/21d849b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000121

Apple Developer Tools
Xcode 6.2 (6776)
Build 6C131e

Version: (Business Edition)
Hash: 981acb3
Build date: 2015-03-25 14:21:05-0400

Version: (Business Edition)
Android SDK: /Users/paw/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0.3 (API level 15)
		4.4   (API level 19)
Java SDK: /usr
No Java runtime present, requesting install.

Xamarin Android Player
Not Installed
Comment 10 Paola Villarreal 2015-04-01 00:15:42 UTC
@Jimmy: Quick workaround: Link all assemblies instead of only SDK assemblies.
Comment 11 Dylan Kelly 2015-04-01 13:05:38 UTC
I can also reproduce this issue on mono 4.0. As Paola said, one temporary workaround is linking all assemblies instead of SDK assemblies only.

=== Xamarin Studio ===

Version 5.9 (build 385)
Installation UUID: 476d6850-22f1-4443-980f-6137a73b4b1f
	Mono 4.0.0 ((detached/21d849b)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400000121

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 3abf86b
Branch: master
Build date: 2015-04-01 09:55:38-0400

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/dylankelly/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
		5.0   (API level 21)
Java SDK: /usr
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 509000385
Git revision: 6fde6079a4d2d27b0eecb290698cafa9feda0338
Build date: 2015-03-31 11:09:26-04
Xamarin addins: 1cec366dee6d690e1ef5df30289b08d03c21c8cd

=== Operating System ===

Mac OS X 10.10.2
Comment 12 Sebastien Pouliot 2015-04-01 13:16:14 UTC
That just means the culprit/miscompiled code is not used and the linker can eliminate it, i.e. it's not a general workaround.
Comment 13 Sebastien Pouliot 2015-04-01 14:46:44 UTC
@Dylan did you fix the bug ? if so can you add more details (e.g. commit hash)
Comment 14 Dylan Kelly 2015-04-01 14:47:45 UTC

Sorry, too many tabs open, accidentally closed the wrong bug.
Comment 15 Marek Safar 2015-04-03 09:55:36 UTC
Fixed in master/Mono 4.0