Windows phone 被动扩展、Akavache和Refit对于Windows Phone';内部卡
我想在我的应用程序和应用程序中使用 问题是,根据我的逻辑,Windows Phone不喜欢我这样做,我做了以下几点:Windows phone 被动扩展、Akavache和Refit对于Windows Phone';内部卡,windows-phone,system.reactive,reactiveui,akavache,refit,Windows Phone,System.reactive,Reactiveui,Akavache,Refit,我想在我的应用程序和应用程序中使用 问题是,根据我的逻辑,Windows Phone不喜欢我这样做,我做了以下几点: var defer = Observable.Defer(() => BlobCache.Secure.GetAndFetchLatest("Semesters", () => _api.GetSemesters()) .Select(x => x.Single(semester => semester.AbredgedName =
var defer = Observable.Defer(() =>
BlobCache.Secure.GetAndFetchLatest("Semesters", () => _api.GetSemesters())
.Select(x => x.Single(semester => semester.AbredgedName == "H2014"))
.SelectMany(currentSemester => BlobCache.Secure.GetAndFetchLatest("Schedule_" + currentSemester.AbredgedName,
() => _api.GetSchedule(currentSemester.AbredgedName)))
);
defer.Subscribe(scheduleVms => {
foreach (var activity in scheduleVms)
{
Debug.WriteLine("1 {0}", activity.Name);
}
});
Observable.Timer(TimeSpan.FromSeconds(4)).Subscribe(_ =>
{
defer.Subscribe(scheduleVms => {
foreach (var activity in scheduleVms)
{
Debug.WriteLine("2 {0}", activity.Name);
}
});
});
我获取学期(从缓存,然后获取),选择想要的学期(我将H2014放在测试中),获取所选(多个)学期的时间表(从缓存,然后获取,如下所示:
var defer = Observable.Defer(() =>
BlobCache.Secure.GetAndFetchLatest("Semesters", () => _api.GetSemesters())
.Select(x => x.Single(semester => semester.AbredgedName == "H2014"))
.SelectMany(currentSemester => BlobCache.Secure.GetAndFetchLatest("Schedule_" + currentSemester.AbredgedName,
() => _api.GetSchedule(currentSemester.AbredgedName)))
);
defer.Subscribe(scheduleVms => {
foreach (var activity in scheduleVms)
{
Debug.WriteLine("1 {0}", activity.Name);
}
});
Observable.Timer(TimeSpan.FromSeconds(4)).Subscribe(_ =>
{
defer.Subscribe(scheduleVms => {
foreach (var activity in scheduleVms)
{
Debug.WriteLine("2 {0}", activity.Name);
}
});
});
如果我使用的TimeSpan.FromSeconds为5或更多,它会满足我的要求,就像我给Windows Phone呼吸的时间一样。否则(在5-ish下),我得到的例外情况如下:
var defer = Observable.Defer(() =>
BlobCache.Secure.GetAndFetchLatest("Semesters", () => _api.GetSemesters())
.Select(x => x.Single(semester => semester.AbredgedName == "H2014"))
.SelectMany(currentSemester => BlobCache.Secure.GetAndFetchLatest("Schedule_" + currentSemester.AbredgedName,
() => _api.GetSchedule(currentSemester.AbredgedName)))
);
defer.Subscribe(scheduleVms => {
foreach (var activity in scheduleVms)
{
Debug.WriteLine("1 {0}", activity.Name);
}
});
Observable.Timer(TimeSpan.FromSeconds(4)).Subscribe(_ =>
{
defer.Subscribe(scheduleVms => {
foreach (var activity in scheduleVms)
{
Debug.WriteLine("2 {0}", activity.Name);
}
});
});
引发异常:mscorlib.ni.dll中的“System.NotSupportedException”
堆栈跟踪:
at MS.Internal.Modern.InternalNetworkStream.BeginRead(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
at System.IO.Stream.<BeginEndReadAsync>b__d(Stream stream, ReadWriteParameters args, AsyncCallback callback, Object state)
at System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef, TArgs args, Func`5 beginMethod, Func`3 endMethod)
at System.IO.Stream.BeginEndReadAsync(Byte[] buffer, Int32 offset, Int32 count)
at System.IO.Stream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.Net.Http.DelegatingStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.Net.Http.DelegatingStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
at System.IO.Stream.<CopyToAsyncInternal>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Refit.RequestBuilderImplementation.<>c__DisplayClass2a`1.<<buildCancellableTaskFuncForMethod>b__29>d__2c.MoveNext()
位于MS.Internal.Modern.InternalNetworkStream.beginhead(字节[]缓冲区、Int32偏移量、Int32计数、异步回调、对象状态)
在System.IO.Stream.b_u\d(Stream-Stream、ReadWriteParameters-args、AsyncCallback-callback、Object-state)
在System.Threading.Tasks.TaskFactory`1.FromAsyncTrim[TInstance,TArgs](TInstance thisRef,TArgs args,Func`5 beginMethod,Func`3 endMethod)
在System.IO.Stream.BeginEndarAsync(字节[]缓冲区,Int32偏移量,Int32计数)
位于System.IO.Stream.ReadAsync(字节[]缓冲区、Int32偏移量、Int32计数、CancellationToken CancellationToken)
位于System.Net.Http.DelegatingStream.ReadAsync(字节[]缓冲区、Int32偏移量、Int32计数、CancellationToken CancellationToken)
位于System.Net.Http.DelegatingStream.ReadAsync(字节[]缓冲区、Int32偏移量、Int32计数、CancellationToken CancellationToken)
在System.IO.Stream.d_uu2.MoveNext()中
---来自引发异常的上一个位置的堆栈结束跟踪---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Refit.RequestBuilderImplementation.c__显示Class2A`1.d__2c.MoveNext()时
通缉行为:
- 链条无需重新安装,即可正常工作
- 链接选择了GetSchedule和GetSemesters,但没有链接,并且它可以工作
如果你们对周围的工作或我做错的事情有什么想法,请告诉我!你们设法解决了吗?你们设法解决了吗?