2013-05-13 36 views
1

我有最新的Xamarin.iOS beta;試圖使用任何異步方法會觸發JIT異常。無論方法的內容如何都會發生。Xamarin.iOS beta引發異步方法JIT

控制器我從運行它(主要是內臟保存令牌異步方法)

using System; 
using System.Drawing; 
using System.Net.Http; 
using MonoTouch.Foundation; 
using System.Collections.Generic; 
using MonoTouch.UIKit; 
using Archer.Base; 



namespace Archer.Ios 
{ 
    public class CategoryTableViewController : UITableViewController 
    { 
     public CategoryTableViewController() : base (UITableViewStyle.Grouped) 
     { 
     } 
     String foo; 

     public override void DidReceiveMemoryWarning() 
     { 
      // Releases the view if it doesn't have a superview. 
      base.DidReceiveMemoryWarning(); 

      // Release any cached data, images, etc that aren't in use. 
     } 

     public override void ViewDidLoad() 
     {   
      base.ViewDidLoad(); 
     //*snip* 
     } 

     public override void ViewDidAppear (bool animated) 
     { 
      LoadCategories(); 
      base.ViewDidAppear (animated); 
     } 

     public async void LoadCategories() 
     { 
      foo = await (new HttpClient()).GetStringAsync 
("http://ifconfig.me/all.json"); 
     } 
    } 
} 

System.ExecutionEngineException:試圖JIT編譯方法 「System.Runtime.CompilerServices.AsyncVoidMethodBuilder:啓動 (Archer.Ios.CategoryTableViewController/c__async0 &)'',而運行 與 - 只 - 。有關 的更多信息,請參閱http://docs.xamarin.com/ios/about/limitations

在Archer.Ios.CategoryTableViewController.LoadCategories()[0x00000] 在:0在Archer.Ios.CategoryTableViewController.ViewDidLoad() [0x0009d]在 /Users/apaulin/src/Archer/Archer.Ios/ CategoryTableViewController.cs:43 處(包皮管理到本機) MonoTouch.ObjCRuntime.Messaging:void_objc_msgSend(IntPtr的,IntPtr的)在 MonoTouch.UIKit.UIWindow.MakeKeyAndVisible()[0x00008]在 /開發商/ MonoTouch的/源/ monotouch/src/UIKit/UIWindow.g.cs:129在 Archer.Ios.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication應用程序,MonoTouch.Foundation.NSDictionary 選項)[0x00054] /Users/apaulin/src/Archer/Archer.Ios/AppDelegate.cs:39 at(包裝器 託管到本機)MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string [] ,intptr,intptr)在MonoTouch.UIKit.UIApplication.Main (System.String [] args,System.String principalClassName,System.String delegateClassName)[0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit /UIApplication.cs:38在 Archer.Ios.Application.Main(System.String []參數)[0x00001]在 /Users/apaulin/src/Archer/Archer.Ios/Main.cs:17

+1

您發佈的例外不足以幫助您。你有沒有在目前的穩定版本中存在這個問題?如果您需要Beta版本的幫助,您必須聯繫Xamarin。 – 2013-05-13 15:47:43

+0

發佈您的一些異步代碼,讓我們知道發生了什麼。我在一些項目上一直在使用這個測試版,並沒有遇到這個問題 - 只有一個地方我得到了一個簡單的解決方法的「無效的IL」消息。 – jonathanpeppers 2013-05-13 17:11:21

回答

1

解決:在導致JIT問題的代碼中有一個麻煩的泛型方法。

0

試試你的代碼的幾個組合,看看你是否可以f解決具體問題。

這裏是嘗試一個例子:

 public async Task<string> LoadCategories() 
     { 
      var client = new HttpClient(); 

      return await client.GetStringAsync("http://ifconfig.me/all.json"); 
     } 

如果你的組合之一的作品,我會發佈一個錯誤,以Xamarin's Bugzilla用破碎例子,然後發佈您的解決辦法了。這將有助於Xamarin修復它。