Disable iOS Tasks Mid-Run

Something throws my running tasks at a certain point in the code (see below). It just stops executing. This only happens on iOS devices. It works great on iOS simulators and Android devices. Has anyone seen something like this before? I don’t think it’s deadlocks or race conditions, because then it will not be successfully completed on other devices?

Here is the code:

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

Edit: reduced code to make the problem more clear.

+4
source share
2 answers

iOS . Xamarin info ( , - ).

, iOS ( Mac JIT), iOS ( iOS ).

+1

.    cacheProvider.Cache(x); Execute Execute, . , , CI adhoc, .

0

All Articles