Bug 59436 - MT3001 error
Summary: MT3001 error
Alias: None
Product: iOS
Classification: Xamarin
Component: Mono runtime / AOT compiler (show other bugs)
Version: XI 10.12 (d15-3)
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.5
Assignee: Zoltan Varga
: 59245 (view as bug list)
Depends on:
Reported: 2017-09-13 07:22 UTC by Jacek Wicherek
Modified: 2018-01-08 12:29 UTC (History)
7 users (show)

See Also:
Is this bug a regression?: Yes
Last known good build: XI (d15-2: d2270eec)

Xamarin info + build log (3.38 MB, text/plain)
2017-09-13 07:22 UTC, Jacek Wicherek
Build folder (6.47 MB, application/zip)
2017-09-13 08:09 UTC, Jacek Wicherek
XI test project (4.55 KB, application/zip)
2017-10-10 11:11 UTC, Rolf Bjarne Kvinge [MSFT]

Description Jacek Wicherek 2017-09-13 07:22:01 UTC
Created attachment 24708 [details]
Xamarin info + build log

After upgrading Xamarin Studio on my Mac Mini I received similar error: could not AOT the assembly (MT3001). 
Before upgrading everything was ok.

I attached detailed log from my build and information about Xamarin Version.
Tell me after reading my log if you need the solution that we have to recreate the error.
Comment 1 Zoltan Varga 2017-09-13 07:34:05 UTC
Could you upload the contents of the '/Users/jacekwicherek/Projects/nommono/Nom3AT/Nom3Max/Nom3Max.iOs/obj/iPhone/AppStore_BOS/mtouch-cache/64/Build' directory ?

As a workaround, disable the usage of LLVM in project options.
Comment 2 Jacek Wicherek 2017-09-13 08:09:16 UTC
Created attachment 24712 [details]
Build folder
Comment 3 Alex Soto [MSFT] 2017-09-13 08:41:21 UTC
Confirming this per comment #1
Comment 4 Zoltan Varga 2017-09-13 10:23:27 UTC
I can reproduce the problem.
Comment 5 Zoltan Varga 2017-09-13 17:45:05 UTC
Could you paste the source of the TransferDispositionController::ValidateAmount () method ?
Comment 6 Jacek Wicherek 2017-09-14 06:12:51 UTC
Function's body:

        bool ValidateAmount(bool canAmountBeZero)
            var valid = _ammount < 9999999.0;

                valid &= canAmountBeZero ? 0.0 <= _ammount :  0.0 < _ammount;

            if(valid && _freeFunds.HasValue)
                Decimal ammount = new Decimal(_ammount);
                Decimal avaliable = new Decimal(_freeFunds.Value);

                valid = ammount <= avaliable;

            AmountInvalid.Value = !valid;

            return valid;
Comment 7 Zoltan Varga 2017-09-14 06:25:50 UTC

Minimal testcase:
using System;
using System.Runtime.InteropServices;
using System.IO;
using System.Collections.Generic;
using System.Threading;

class Driver {
	public bool check () {
		bool valid = false;

		double d1 = 1.0;
		double d2 = 2.0;

		Decimal ammount = new Decimal(d1);
		Decimal avaliable = new Decimal(d2);

		valid = ammount <= avaliable;
		return valid;

    static void Main () {

Compile with:
csc /optimize+ bug.cs
mono --aot --llvm bug.exe
Comment 8 Zoltan Varga 2017-09-14 07:12:24 UTC
Comment 9 Zoltan Varga 2017-09-24 08:40:46 UTC
Fixed in mono master 7348e275ffe2683f1b6e5b738e4d21f0fe561835.
Comment 10 Zoltan Varga 2017-09-24 08:42:07 UTC
*** Bug 59245 has been marked as a duplicate of this bug. ***
Comment 11 Rolf Bjarne Kvinge [MSFT] 2017-10-06 07:22:32 UTC
@Zoltan, was this backported to any other branches? It sounds like this is a regression, so we should get it in at least d15-5, if not earlier (xcode9.1 for instance)
Comment 12 Zoltan Varga 2017-10-10 10:10:05 UTC
2017-06: https://github.com/mono/mono/pull/5755
Comment 13 Rolf Bjarne Kvinge [MSFT] 2017-10-10 11:11:35 UTC
Created attachment 25241 [details]
XI test project

Attaching Xamarin.iOS test project (build for Release|iDevice to reproduce the MT3001 error)
Comment 14 Rolf Bjarne Kvinge [MSFT] 2017-10-10 11:16:05 UTC
I can reproduce the regression with d15-3 (and master), but not d15-2.
Comment 20 richard 2017-11-09 04:27:22 UTC
So what is the status on this thing getting into a Xamarin Build. I can't get onto the new IOS SDK - and in a couple months won't be able to submit to the store with updates. Been busted two months now - a long time.
Comment 21 Rolf Bjarne Kvinge [MSFT] 2017-11-13 17:06:23 UTC
@Richard, there are beta builds with this fix included (Xamarin.iOS 11.4), please use the beta channel to try them out.
Comment 22 Richard Simpson 2017-12-01 22:31:37 UTC
Would this issue also cause:
  MTOUCH : error MT3001: Could not AOT the assembly '/Users/vsts/agent/2.124.0/work/1/s/****.Mobile/****.Mobile.iOS/obj/iPhone/Release/mtouch-cache/Build/System.Runtime.CompilerServices.Unsafe.dll' [/Users/vsts/agent/2.124.0/work/1/s/****.Mobile/****.Mobile.iOS/****.Mobile.iOS.csproj]
Comment 23 Rolf Bjarne Kvinge [MSFT] 2018-01-08 12:29:15 UTC
@Richard Simpson: there are many potential reasons for the MT3001 error, so if you can still reproduce any issues with the current stable release, please file a new bug and we'll have a look.

Note You need to log in before you can comment on or make changes to this bug.