【发布时间】:2012-12-28 19:15:53
【问题描述】:
我正在尝试运行 Windows Azure 移动服务查询(使用 SDK 的 xamarins monotouch 分支)。
这段代码在模拟器上运行良好,但在设备上崩溃了:
this.table.Where (a => a.Sequence == sequence).Where (a => a.Week == week).ToListAsync()
.ContinueWith (t =>
{
this.items = t.Result;
this.tableView.ReloadData ();
IsUpdating = false;
}, scheduler);
我得到的错误是:
调用的目标已抛出异常。 ---> System.Exception:尝试 JIT 编译方法 'System.Linq.jvm.Runner:GetDelegate ()' 同时运行 --aot-only。
我设法使它工作的唯一一件事就是删除 where 条件。 这工作得很好,除了我(显然)没有根据需要过滤结果。
我应该如何重写我的代码以使其在实际的 iOS 设备上运行?
更新: table 是 *IMobileServiceTable *
类型的类变量week 和 sequence 都是 int 类型。
Activity 是一个 POCO 类。
public class Activity
{
public int ID {
get;
set;
}
public string Name {
get;
set;
}
public int CaloricRequirementMin {
get;
set;
}
public int CaloricRequirementMax {
get;
set;
}
public string Difficulty {
get;
set;
}
public int PlanId {get;set;}
public string Type {
get;
set;
}
public int Sequence {
get;
set;
}
public int Week {
get;
set;
}
public int SubscriptionActivityId {
get;
set;
}
}
我已仔细检查以确保这些都已填充。
它在模拟器上完美无瑕。
【问题讨论】:
-
您是否必须删除两个 where 条件?它是否以单个 where 条件运行? Monotouch(在设备上)在 JIT 编译时存在局限性。
-
是的。对于单一条件,它也会因相同的错误而失败。删除这两个条件是我能够成功运行它的唯一方法。
-
只是问问题,因为我不能简单地测试代码。同步 .ToList() 是否有效?可以是您的表/对象定义吗?
-
SDK没有提供同步ToList方法:s
-
抱歉问了这个愚蠢的问题。我确实认为问题不在这部分代码中,而更有可能在表/对象定义中。您的对象是否有子关系或其他依赖关系?这篇文章似乎相关:siaqodb.com/forum/index.php?topic=365.0
标签: linq xamarin.ios jit aot azure-mobile-services