Bug 26890 - ExecutionEngine/JIT Error Since Latest Update
Summary: ExecutionEngine/JIT Error Since Latest Update
Status: RESOLVED FIXED
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 3.9
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-02-09 20:59 UTC by troywillmot
Modified: 2016-12-22 17:56 UTC (History)
8 users (show)

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


Attachments
screenshot of VS showing only default as SDK option (57.67 KB, image/jpeg)
2015-02-10 15:46 UTC, troywillmot
Details
Screenshot of vs showing disabled generic value type sharing option (66.92 KB, image/jpeg)
2015-02-10 15:47 UTC, troywillmot
Details


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 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:
Status:
RESOLVED FIXED

Description troywillmot 2015-02-09 20:59:49 UTC
It appears the latest Xamarin update for Mac and/or VS is causing JIT/Execution engine exceptions in code that used to work fine, especially around Xamarin Forms XAML usage.

More details here;

http://forums.xamarin.com/discussion/32572/xamarin-forms-on-ios-jit-failure-with-onplatform-xaml#latest

Basically an exception such as;

System.ExecutionEngineException: Attempting to JIT compile method 'Xamarin.Forms.OnPlatform`1<Xamarin.Forms.Thickness>:.ctor ()

Is thrown when using XAML like the following is used in a Xamarin Forms page;

<local:ContentViewBase.Padding>
    <OnPlatform x:TypeArguments="Thickness">
        <OnPlatform.iOS>12,20,12,0</OnPlatform.iOS>
    </OnPlatform>
</local:ContentViewBase.Padding>

Prior to the update, this was working fine and doesn't seem like it should be causing an issue now (and if it should, what is the correct way to do this?).

A second example relating to relative layouts set from code behind is listed in the linked forum post.
Comment 1 troywillmot 2015-02-09 21:00:51 UTC
VS Version details

Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51650

Installed Version: Ultimate

Application Builder For Windows Embedded Compact 2013   06181-004-0449004-02623
Application Builder For Windows Embedded Compact 2013

Architecture and Modeling Tools   06181-004-0449004-02623
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Team Explorer for Visual Studio 2013   06181-004-0449004-02623
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0449004-02623
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0449004-02623
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0449004-02623
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0449004-02623
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0449004-02623
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0449004-02623
Windows Phone SDK 8.0 - ENU

.NET Memory Profiler   4.6
.NET Memory Profiler Visual Studio Integration Package

ASP.NET and Web Tools   12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.3
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure HDInsight HQL Service   1.0.0000.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   1.0.0000.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.4
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.4.20730.1601

Microsoft Azure Tools   2.5
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.5.21104.1601

Microsoft Team Foundation Server 2013 Power Tools   12.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.

Microsoft Visual Studio Process Editor   1.0
Process Editor for Microsoft Visual Studio Team Foundation Server

NuGet Package Manager   2.8.50926.663
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Release Management for Visual Studio Package   1.0
Release Management for Visual Studio

SQL Server Data Tools   12.0.41025.0
Microsoft SQL Server Data Tools

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Xamarin   3.9.289.0 (39a70ae)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.6.1.0 (3b3ef438017c7ecf486defa9e01567a5f2b3cb2a)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified





Mac Version Details
Microsoft Visual Studio Ultimate 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.51650

Installed Version: Ultimate

Application Builder For Windows Embedded Compact 2013   06181-004-0449004-02623
Application Builder For Windows Embedded Compact 2013

Architecture and Modeling Tools   06181-004-0449004-02623
Microsoft Architecture and Modeling Tools
    
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Team Explorer for Visual Studio 2013   06181-004-0449004-02623
Microsoft Team Explorer for Visual Studio 2013

Visual Basic 2013   06181-004-0449004-02623
Microsoft Visual Basic 2013

Visual C# 2013   06181-004-0449004-02623
Microsoft Visual C# 2013

Visual C++ 2013   06181-004-0449004-02623
Microsoft Visual C++ 2013

Visual F# 2013   06181-004-0449004-02623
Microsoft Visual F# 2013

Visual Studio 2013 Code Analysis Spell Checker   06181-004-0449004-02623
Microsoft® Visual Studio® 2013 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Windows Phone SDK 8.0 - ENU   06181-004-0449004-02623
Windows Phone SDK 8.0 - ENU

.NET Memory Profiler   4.6
.NET Memory Profiler Visual Studio Integration Package

ASP.NET and Web Tools   12.4.51016.0
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Microsoft Azure Websites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Microsoft Azure

ASP.NET Web Frameworks and Tools 2012.2   4.1.21001.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013   5.2.21010.0
For additional information, visit http://www.asp.net/

Common Azure Tools   1.3
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Microsoft Advertising SDK for Windows Phone   
Microsoft Advertising SDK for Windows Phone
Build 

Microsoft Azure HDInsight HQL Service   1.0.0000.0
Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio   1.0.0000.0
An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools   1.3
Microsoft Azure Mobile Services Tools

Microsoft Azure Tools   2.4
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.4.20730.1601

Microsoft Azure Tools   2.5
Microsoft Azure Tools for Microsoft Visual Studio 2013 - v2.5.21104.1601

Microsoft Team Foundation Server 2013 Power Tools   12.0
Power Tools that extend the Team Foundation Server integration with Visual Studio.

Microsoft Visual Studio Process Editor   1.0
Process Editor for Microsoft Visual Studio Team Foundation Server

NuGet Package Manager   2.8.50926.663
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PowerShell Tools   1.3
Provides file classification services using PowerShell

PreEmptive Analytics Visualizer   1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Release Management for Visual Studio Package   1.0
Release Management for Visual Studio

SQL Server Data Tools   12.0.41025.0
Microsoft SQL Server Data Tools

Windows Azure Tools   2.3
Windows Azure Tools for Microsoft Visual Studio 2013 - v2.3.20320.1602

Windows Phone 8.1 SDK Integration   1.0
This package integrates the tools for the Windows Phone 8.1 SDK into the menus and controls of Visual Studio.

Xamarin   3.9.289.0 (39a70ae)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.20.0.34 (49a04b966feb40dfdba49d57ba16249b66d606a6)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.6.1.0 (3b3ef438017c7ecf486defa9e01567a5f2b3cb2a)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration   1.0
Automated migration for Xamarin iOS Classic projects to Unified
Comment 2 troywillmot 2015-02-09 21:06:31 UTC
Sorry, Mac version details should be;

=== Xamarin Studio ===

Version 5.7.1 (build 17)
Installation UUID: 3390ff59-8ae8-42bc-b1ea-de620f832a41
Runtime:
	Mono 3.12.0 ((detached/de2f33f)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000076

=== Xamarin.Android ===

Version: 4.20.0.28 (Starter Edition)
Android SDK: /Users/DevMacMini/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
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.Mac ===

Not Installed

=== Xamarin.iOS ===

Version: 8.6.1.20 (Business Edition)
Hash: 3b3ef43
Branch: 
Build date: 2015-01-24 09:42:21-0500

=== Build Information ===

Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.10.2
Darwin Troys-Mac-mini.local 14.1.0 Darwin Kernel Version 14.1.0
    Mon Dec 22 23:10:38 PST 2014
    root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
Comment 3 Sebastien Pouliot 2015-02-09 22:20:20 UTC
Can you make sure that the "iOS Build" options, "Advanced" tab has "Enable generic value type sharing" enabled ?

If it is can you attach a small sample that reproduce the issue (some other configuration options might be causing this) and tell us which iOS device you're using ? Thanks
Comment 4 troywillmot 2015-02-10 15:11:09 UTC
Ok, it looks like the problem is 'generic value type sharing' - it's not only unchecked in my project but also disabled so I can't change it. 

I created a test project and it works fine if generic value type sharing is on (and it is by default), but fails if it's off.

I'm just now noticing that in my project file the SDK setting is 'Default' but in a new project it's 8.1 - but there are no other options in the SDK drop down. Also my list of support architectures doesn't include arm64 despite my having thought I'd upgraded this project properly. A new project doesn't have these issues.

Any idea what might be wrong in my project file to be causing these issues?

Also the info icon next to 'generic value type sharing' doesn't seem to have any tooltip/help associated with it.
Comment 5 Sebastien Pouliot 2015-02-10 15:19:24 UTC
That's weird. While that option might be removed in the future (so it cannot be disabled) I'm not aware of any condition that should disable it.

Are you seeing this in XS, VS or both ? 

Can you attach screenshots ?
Comment 6 troywillmot 2015-02-10 15:44:41 UTC
Hi,

Thanks for getting back to me. I'm seeing this in VS (2013). I don't have the source code easily accessible on the Mac (we use TFS etc. and I don't use XS, so I'm just not setup to open the source code from there) - and of course XS on Windows doesn't support Mac projects.

I'll add some screenshots from VS.
Comment 7 troywillmot 2015-02-10 15:46:56 UTC
Created attachment 9754 [details]
screenshot of VS showing only default as SDK option
Comment 8 troywillmot 2015-02-10 15:47:26 UTC
Created attachment 9755 [details]
Screenshot of vs showing disabled generic value type sharing option
Comment 9 troywillmot 2015-02-10 16:19:53 UTC
Ok, managed to copy the source to the mac and open it. XS doesn't have that option disabled, shows both default and 8.1 as sdk version options and has all the architecture options available too.

I tried editing the project file in XS on the mac and copying back to my source folder in Windows, but VS seems to auto-uncheck and disable the box again. Same thing if I just manually edit the csproj file on windows and set the MtouchEnableGenericValueTypeSharing node to have a value of true - when I reload project in VS the box is unchecked and disabled again.
Comment 10 Sebastien Pouliot 2015-02-10 16:26:12 UTC
@Troy thanks for the details. As a workaround can you try adding 

> --gsharedvt=true

to the additional mtouch arguments. That should enable the option (like the UI would normally do).


-> XVS

Guys, any clue why this (comment #8 screenshot) would be disabled ?

It should be enabled by default (templates) and (right now) user selectable.
Comment 11 troywillmot 2015-02-10 16:41:42 UTC
Just to confirm - if I create a new mobile app project in VS, that option is enabled. I'm not sure what's different about my existing project.

I will try the mtouch arguments.

Thanks heaps guys.
Comment 12 troywillmot 2015-02-10 16:43:22 UTC
I could send just the csproj file if you like - not sure if that will help (probably contains pointers to a bunch of stuff you guys won't have).
Comment 13 Ray Perkins 2015-02-10 17:15:26 UTC
I was facing a similar issue with a System.ExecutionEngineException: Attempting to JIT compile method being thrown when adding a child to any Relative Layouts on iOS. 
The issue has been fixed by ticking the 'Enable generic value type sharing' option.
Comment 14 troywillmot 2015-02-10 17:33:20 UTC
Ok, that command line option seems to have solved the original issue. I still
can't select arm64 as a supported architecture though, so I won't be able to
submit to the Apple store now. Is there a similar command line to pick
architectures?
Thanks.
Comment 15 Sebastien Pouliot 2015-02-10 18:05:50 UTC
@Troy not sure what could have append to your .csproj. Hopefully the XVS guys will be able to tell you soon.

> Is there a similar command line to pick architectures?

Yes, you can use `--abi=arm64,armv7` to tell mtouch to build a fat binary with both an ARMv7 and an ARM64 slices.
Comment 16 troywillmot 2015-02-11 19:58:28 UTC
Any progress on this?
Comment 17 Ray Perkins 2015-02-12 16:22:10 UTC
All the ARM64 architecture options appeared after I edited the .csproj and changed <MtouchArch>ARMv7</MtouchArch> to <MtouchArch>ARMv7, ARMv7s, ARM64</MtouchArch> under the 'AppStore|iPhone' configuration. But the options for ARM64 are only visible to the configuration that I edited. Ie: if I add ARM64 to the AppStore and Release but not Debug then the ARM64 options are not able to be selected for the Debug configuration.

Also the Enable Type sharing is now disabled for all the configurations which means when I build it the application will not run due to crashing with a JIT comile error.

The work around is unload the project, check all the options are as they should be and then reload and building. 

So, I am also waiting on a fix.
Comment 18 Joaquin Jares 2016-12-22 17:56:34 UTC
This feature was added recently. I'm closing this bug for verification. Please feel free to reopen it if it's still an issue.