|Summary:||AOT issue with await Task<bool> on Visual Studio 2015|
|Product:||iOS||Reporter:||Mark Smith <mark.smith>|
|Component:||Mono runtime / AOT compiler||Assignee:||Zoltan Varga <vargaz>|
|Severity:||blocker||CC:||arpitj, gouri.kumari, joe, kumpera, kzu, miguel, mono-bugs+bugzilla, mono-bugs+monotouch, pj.beaman, rolf, sebastien, shrutis, udhams, vargaz|
|Target Milestone:||9.2 (C6)|
|Tags:||VSXF||Is this bug a regression?:||---|
|Last known good build:|
|Attachments:||Sample Project + Screenshot|
Description Mark Smith 2015-10-15 22:50:35 UTC
Created attachment 13359 [details] Sample Project + Screenshot Calling a method that returns Task<bool> and attempting to await on it generates an exception on physical device: System.ExecutionEngineException: Attempting to JIT compile method 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<bool>:System.Runtime.CompilerServices.IAsyncMethodBuilder.PreBoxInitialization<TStateMachine> (TStateMachine&)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information. (See attached screenshot). However, if you take the same project and build it under Xamarin Studio on the Mac, it runs fine on the same device. Sample Project attached. === Xamarin Studio === Version 5.10 (build 811) Installation UUID: 50562e10-5ff9-448f-b0e4-17ca662d9b75 Runtime: Mono 4.2.1 (explicit/804ddbc) GTK+ 2.24.23 (Raleigh theme) Package version: 402010060 === Xamarin.Profiler === Version: 0.22.0.0 Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler === Xamarin.Android === Version: 220.127.116.11 (Business Edition) Android SDK: /Users/mark/Android/sdk 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) 4.4.87 (API level 20) 5.0 (API level 21) 5.1 (API level 22) 6.0 (API level 23) SDK Tools Version: 24.3.4 SDK Platform Tools Version: 23 SDK Build Tools Version: 23 Java SDK: /usr java version "1.7.0_75" Java(TM) SE Runtime Environment (build 1.7.0_75-b13) Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode) === Xamarin Android Player === Version: 0.6.2 Location: /Applications/Xamarin Android Player.app === Apple Developer Tools === Xcode 7.0.1 (8228) Build 7A1001 === Xamarin.Mac === Version: 18.104.22.168 (Business Edition) === Xamarin.iOS === Version: 22.214.171.124 (Business Edition) Hash: b5396c2 Branch: master Build date: 2015-09-30 15:22:15-0400 === Build Information === Release ID: 510000811 Git revision: 34cd31ea72536afab530c14d9220b286075e83cd Build date: 2015-09-30 10:40:37-04 Xamarin addins: 8e6fccfc0c19a7e0b7b11be925f09751d827eb5c Build lane: monodevelop-lion-cycle6 === Operating System === Mac OS X 10.11.1 Darwin Marks-MBP-2.local 15.0.0 Darwin Kernel Version 15.0.0 Sun Oct 11 19:48:54 PDT 2015 root:xnu-3247.10.11~3/RELEASE_X86_64 x86_64 -------- Microsoft Visual Studio Enterprise 2015 Version 14.0.23107.0 D14REL Microsoft .NET Framework Version 4.6.00079 Installed Version: Enterprise Architecture and Modeling Tools 00322-90150-03764-AA760 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. Visual Basic 2015 00322-90150-03764-AA760 Microsoft Visual Basic 2015 Visual C# 2015 00322-90150-03764-AA760 Microsoft Visual C# 2015 Visual C++ 2015 00322-90150-03764-AA760 Microsoft Visual C++ 2015 Windows Phone SDK 8.0 - ENU 00322-90150-03764-AA760 Windows Phone SDK 8.0 - ENU Application Insights Tools for Visual Studio Package 1.0 Application Insights Tools for Visual Studio ASP.NET and Web Tools 14.0.20626.0 ASP.NET and Web Tools ASP.NET Web Frameworks and Tools 2013 5.2.30624.0 For additional information, visit http://www.asp.net/ Color Theme Designer 1.0 Designer for creating new color themes Common Azure Tools 1.5 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools. GenerateUnitTest 1.0 Generates unit test code for methods in classes under test. GitHub.VisualStudio 1.0 A Visual Studio Extension that brings the GitHub Flow into Visual Studio. JetBrains ReSharper Ultimate 2015.2 Build 103.0.20150818.200216 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2015 JetBrains, Inc. Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools Microsoft Code Digger 0.9 Microsoft Code Digger Microsoft.Pex.VisualStudio 1.0 Pex NuGet Package Manager 3.2.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/. PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product. SQL Server Data Tools 14.0.50717.0 Microsoft SQL Server Data Tools Visual Studio Spell Checker VSSpellChecker An editor extension that checks the spelling of comments, strings, and plain text as you type. Visual Studio Tools for Universal Windows Apps 14.0.23121.00 D14OOB The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit. Web Essentials 2015 0.5.183 Adds many useful features to Visual Studio for web developers. Xamarin 126.96.36.1996 (5abb0de) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin.Android 188.8.131.52 (f94dc5b) Visual Studio plugin to enable development for Xamarin.Android. Xamarin.iOS 184.108.40.206 (b5396c2) Visual Studio extension to enable development for Xamarin.iOS.
Comment 1 PJ 2015-10-15 23:02:10 UTC
Since this manifests only when building from VS, moving there.
Comment 2 Zoltan Varga 2015-10-16 00:22:57 UTC
This usually happens when the -O=gsharedvt argument is not passed to the aot compiler. Could you attach the build output ?
Comment 3 Arpit Jha 2015-10-16 08:41:38 UTC
I have checked this issue and able to reproduce this issue using build Xamarin.VisualStudio_220.127.116.117_74739827abbb98b1b6e751ed8428dff3d6fee28d monotouch-18.104.22.168_1a6b88f2b2305d50bad065ae4c7292ab6348ff60 and steps mentioned in bug description. Screencast: http://www.screencast.com/t/pu5uMz1ZvEO Exception: https://gist.github.com/Rajneesh360Logica/d5bf7de17ba8c49db4e9 VS IDE log: https://gist.github.com/Rajneesh360Logica/6ffea89c289196e9aa77 Observation: VS throws exception when launching application on physical device. REGRESSION: This issue is working fine with latest stable Xamarin.VisualStudio_3.11.1537_a11147b697db127e63af3b0811811a01c30a178e monotouch-22.214.171.124_1d27ac2cea28ce4baac7ca238122e0a8aea5d17a Environment Info: Device:iPhone 4s (iOS 9.0) Windows: https://gist.github.com/Rajneesh360Logica/8f734c7126ea55c91ca3 Mac: https://gist.github.com/Arpit360/438405f2b46da57a282f
Comment 4 Arpit Jha 2015-10-16 09:29:09 UTC
An update to comment 3 : VS Debug output : https://gist.github.com/Rajneesh360Logica/65c2496d6ad834c416c3
Comment 5 Arpit Jha 2015-10-16 09:50:24 UTC
An update to comment 3: Build output : https://gist.github.com/Rajneesh360Logica/9a0517ade979718e5d8f
Comment 6 Mark Smith 2015-10-16 11:19:17 UTC
@Zoltan -- I have verified that the "Share Generic Value Types" flag is checked in the VS project settings. I don't see any mtouch arguments for building in the IDE logs, would that be on the server side? If so, how can I retrieve those?
Comment 7 Mark Smith 2015-10-16 11:20:30 UTC
As an additional data point, if you change the return type to be a simple Task instead of Task<bool>, it works. It also works if you remove the async/await dependency and use ContinueWith constructs (where the state machine is not created).
Comment 8 Zoltan Varga 2015-10-16 12:18:52 UTC
Can you attach the mac side build log, its probably in some log file written to by the mac agent.
Comment 9 Mark Smith 2015-10-16 13:04:56 UTC
It does look like it's in the build output: 2> Task Parameter:EnableGenericValueTypeSharing=True (TaskId:185) Here's the full output: https://gist.github.com/markjulmar/afa9e53b8c8633857b35
Comment 12 Zoltan Varga 2015-10-18 16:22:50 UTC
Could you run the app with the MONO_LOG_LEVEL environment variable set to 'debug' and attach the output ? In xs, it can be set in Project Options/Run/General, no idea where to set them in VS. Also, could you zip up the whole build directory on the build host (no idea where it is) and upload it somewhere ?
Comment 13 Arpit Jha 2015-10-19 05:46:16 UTC
I have checked this issue with latest Cycle 6 build Observation: Getting Exception System.ExecutionEngineException: Attempting to JIT compile method 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<bool>:System.Runtime.CompilerServices.IAsyncMethodBuilder.PreBoxInitialization<TStateMachine> (TStateMachine&)' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information. while app launches on physical device. As per comment I have googled https://bugzilla.xamarin.com/show_bug.cgi?id=34926#c12 MONO_LOG_LEVEL but observed that it works for android https://developer.xamarin.com/guides/android/advanced_topics/environment/ I have set MSBuild output to Diagnostic from Tools ->Option->Project and Solution ->Build and Run ->MSBUild Project build output to verbosity. Build output: https://gist.githubusercontent.com/Rajneesh360Logica/0973da90d126bba6f36f/raw/d29d9a1de05de2126737d0dcd0b5efde659db0b3/gistfile1.txt iOS Device Crash Log: https://gist.github.com/Arpit360/896726fd5998f7beae0a Please let me know if I can provide more info. Environment Info: Device : iPhone 4s (iOS 9.0) Mac: https://gist.github.com/Arpit360/6cc858733a7082596ca4 Windows:https://gist.github.com/Rajneesh360Logica/c3df4b889053d5b56560
Comment 15 Daniel Cazzulino 2015-10-19 11:12:25 UTC
Zoltan, is there anything more Arpit can provide?
Comment 16 Zoltan Varga 2015-10-19 17:50:47 UTC
I can't reproduce this. I was using this package: https://wrench.internalx.com/Wrench/ViewLane.aspx?lane_id=2102&host_id=63&revision_id=638133 and vs 2013 professional, plus x.ios 126.96.36.199 on the mac. Will try with vs2015.
Comment 17 Zoltan Varga 2015-10-19 22:59:37 UTC
This was an AOT compiler problem, it should be fixed by mono master 99d732d4d508feabdf95d737850490a427fb89b6.
Comment 18 Rolf Bjarne Kvinge [MSFT] 2015-10-20 06:13:53 UTC
@Sebastien, this looks like something we should get into C6SR1.
Comment 19 Miguel de Icaza [MSFT] 2015-10-20 09:51:43 UTC
Since this would be a regression against C5, this should likely go into C6-baseline.
Comment 20 Miguel de Icaza [MSFT] 2015-10-20 09:57:21 UTC
Zoltan, this applies fine to 4.2.0-branch, so I assume that this fix is what would fix our Cycle 6 as well, right?
Comment 21 Sebastien Pouliot 2015-10-20 10:19:53 UTC
Backport request tracked in https://trello.com/c/GAuMo9G6/304-xvs-34926-aot-issue-with-await-task-bool-on-visual-studio-2015 QA: This can be verified with maccore/master aa23e77f7fe09eeabfdc573d0b9cb41afb12f370
Comment 22 Miguel de Icaza [MSFT] 2015-10-20 11:07:22 UTC
In addition to the master, a build against cycle6/4.2 was created here, it is waiting to be built: https://code.internalx.com/Wrench/BuildDetails?buildId=f3841aa78de4df8e8a319e26214560a6
Comment 23 Zoltan Varga 2015-10-20 13:54:12 UTC
This is not really a regression, vs 2015 seems to generate different il, which exposed the problem in the generic sharing code.
Comment 24 Arpit Jha 2015-10-21 07:11:28 UTC
I have checked this issue with iOS http://storage.bos.internalx.com/macios-mac-master/aa/aa23e77f7fe09eeabfdc573d0b9cb41afb12f370/monotouch-188.8.131.52.pkg and observed that issue is mentioned in bug description working fine. App launched successfully on device. After launching the app Getting an exception of “System.Exception: Got an error from the web service. MSG:success” while tapped on Testing. Observation : As per my understanding this is the issue from service returning null data I have reported the bug for the same https://bugzilla.xamarin.com/show_bug.cgi?id=35130 Screencast: http://www.screencast.com/t/fkgfwTZM VS Environment Info: https://gist.github.com/Parmendrak/8c68d45c065965364f3b http://storage.bos.internalx.com/macios-mac-master/aa/aa23e77f7fe09eeabfdc573d0b9cb41afb12f370/monotouch-184.108.40.206.pkg OSX:10.10.5 As per bug target milestone is C6, I will verify this issue once the patch will merge in C6
Comment 25 Miguel de Icaza [MSFT] 2015-10-21 09:32:30 UTC
Thanks for the feedback, so not a regression attributed to us, but our users will experience broken code when they move to VS 2015.
Comment 26 Udham Singh 2015-10-26 10:09:44 UTC
I have checked this issue with latest Cycle 6 lane builds and observed that the fix for this issue has been merged with Cycle 6 lane builds. Hence I am closing this issue. Environment Info (Mac): https://gist.github.com/Udham1/afb7be7e414fea4aa44f Environment Info (Windows): https://gist.github.com/Udham1/d1b0e8981b2da9e5c247 Thanks!