我对 Android 目标的 mvvmcross 中的 RIO 绑定有问题。
我有一个相当简单的模型:
public class RJParagraph : MvxNotifyPropertyChanged
{
public INC<String> Title = new NC<string>();
//public INC<DateTime> LastSeen = new NC<DateTime>();
private DateTime _lastSeen;
public DateTime LastSeen
{
get { return _lastSeen; }
set
{
_lastSeen = value;
RaisePropertyChanged(() => LastSeen);
}
}
// constructor etc
}
我在核心项目中有一个服务,其中包含以下 LINQ 查询,其中 refdate 是 DateTime.Now.AddDays(-30):
mylist.Where(f => f.LastSeen > refdate).OrderByDescending(f => f.LastSeen)
当我使用注释行(RIO 日期时间字段)时,Nunit 测试将运行良好,但我的 Android 应用程序将在执行此查询时触发不支持的接口(比较)。NUnit 测试运行良好。(注意:LastSeen.Value 在使用 Rio 时用于 LINQ 查询)
当我使用如上所述的非 RIO 版本时,一切正常。
我一直在寻找如何解决这个问题的线索......也许其他人可以给我一些指示?提前致谢。
(顺便说一句,我对这个框架的努力表示赞赏)
更新:完整错误:
System.ArgumentException: does not implement right interface
07-18 11:31:29.730 I/MonoDroid(20500): UNHANDLED EXCEPTION: System.ArgumentException: does not implement right interface
07-18 11:31:29.730 I/MonoDroid(20500): at System.Collections.Generic.Comparer`1/DefaultComparer<Cirrious.MvvmCross.FieldBinding.INC`1<System.DateTime>>.Compare (Cirrious.MvvmCross.FieldBinding.INC`1<System.DateTime>,Cirrious.MvvmCross.FieldBinding.INC`1<System.DateTime>) <0x004e8>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.SortSequenceContext`2<JaarverslaggevingApp.Core.Models.RJParagraph, Cirrious.MvvmCross.FieldBinding.INC`1<System.DateTime>>.Compare (int,int) <0x000e3>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.QuickSort`1<JaarverslaggevingApp.Core.Models.RJParagraph>.CompareItems (int,int) <0x00067>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.QuickSort`1<JaarverslaggevingApp.Core.Models.RJParagraph>.MedianOfThree (int,int) <0x000df>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.QuickSort`1<JaarverslaggevingApp.Core.Models.RJParagraph>.Sort (int,int) <0x000f7>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.QuickSort`1<JaarverslaggevingApp.Core.Models.RJParagraph>.PerformSort () <0x000f7>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.QuickSort`1/<Sort>c__Iterator39<JaarverslaggevingApp.Core.Models.RJParagraph>.MoveNext () <0x0019f>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Linq.Enumerable/<CreateTakeIterator>c__Iterator30`1<JaarverslaggevingApp.Core.Models.RJParagraph>.MoveNext () <0x004cf>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Collections.Generic.List`1<JaarverslaggevingApp.Core.Models.RJParagraph>.AddEnumerable (System.Collections.Generic.IEnumerable`1<JaarverslaggevingApp.Core.Models.RJParagraph>) <0x0016b>
07-18 11:31:29.730 I/MonoDroid(20500): at System.Collections.Generic.List`1<JaarverslaggevingApp.Core.Models.RJParagraph>..ctor (System.Collections.Generic.IEnumerable`1<JaarverslaggevingApp.Core.Models.RJParagraph>) <0x001bb>
07-18 11:31:29.730 I/MonoDroid(20500): at JaarverslaggevingApp.Core.Services.MockTocService.History () <IL 0x000a7, 0x004af>
07-18 11:31:29.730 I/MonoDroid(20500): at JaarverslaggevingApp.Core.ViewModels.IndexHistoryViewModel..ctor (JaarverslaggevingApp.Core.Services.IGetTocService) <IL 0x00016, 0x00113>
07-18 11:31:29.730 I/MonoDroid(20500): at JaarverslaggevingApp.UI.Android.Fragments.IndexHistoryFragment.OnCreateView (Android.Views.LayoutInflater,Android.Views.ViewGroup,Android.OS.Bundle) [0x0000b] in f:\JaarverslaggevingApp\JaarverslaggevingApp\JR_Android\Views\Fragments\IndexHistoryFragment.cs:25
07-18 11:31:29.730 I/MonoDroid(20500): at Android.Support.V4.App.Fragment.n_OnCreateView_Landroid_view_LayoutInflater_Landroid_view_ViewGroup_Landroid_os_Bundle_ (intptr,intptr,intptr,intptr,intptr) [0x00021] in /Users/builder/data/lanes/monodroid-lion-bs1/0cc7ae3b/source/monodroid-bindings/Compatibility-v4/bindings/obj/platform-15/src/generated/Android.Support.V4.App.Fragment.cs:953
07-18 11:31:29.730 I/MonoDroid(20500): at (wrapper dynamic-method) object.bd483370-f096-4010-b752-21dc83bc68f2 (intptr,intptr,intptr,intptr,intptr) <IL 0x00023, 0x00063>
Unhandled Exception: