Kdo*_*dog 5 c# xamarin.ios async-await xamarin xamarin.forms
有些事情正在使我的运行任务超出代码中的某一点(参见下面的内容).它只是停止执行.它只发生在iOS设备上.在iOS模拟器和Android设备上,它运行完美.以前见过这样的人吗?我不认为这是死锁或种族条件,因为那时它不会在其他设备上成功完成吗?
这是一些代码;
private async Task ExecuteFreshAndPopulateUI(IFetchVehicleCommand command)
{
List<Models.Vehicle.Vehicle> vehicles = await command.ReturnAndExecute<Models.Vehicle.Vehicle>();
var z = 9;
ListPopulateObservableCollection(vehicles, view.Vehicles);
}
public virtual async Task<dynamic> ReturnAndExecute<T>() where T : new()
{
await FlushCache<T>();
await Execute();
await CheckIfCached<T>();
return (dynamic) cachedResult.cachedObject;
}
public override async Task Execute()
{
try
{
dynamic x = await fetchableService.Fetch(userId);
if (x != null)
{
await cacheProvider.Cache(x); // THIS is the last line to be called from this method, it never returns
SetCached(true);
}
}
catch (Exception ex)
{
AddValidationError(ex.Message);
}
}
public async Task Cache(dynamic obj)
{
await database.InsertAllAsync((IEnumerable)obj); // this runs
} // this is the last breakpoint to be hit
Run Code Online (Sandbox Code Playgroud)
编辑:减少代码以使问题更清晰.
| 归档时间: |
|
| 查看次数: |
77 次 |
| 最近记录: |