Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having an issue with code written in F# for xamarin forms app. I added azure mobile service to my app as the backend and also enabled offline sync feature. I am able to add records into the backend but having a huge problem loading the data from the backend

when i run the app and the GetTable method is called, the application stops at the third line of the method. Nothing else works further than that point. It seems more like a dead pool. i think its a runtime error. Any help with this will be appreciated....... Note: An instance is of the Backend class is created and the Initialize method is been called prior to calling the GetTable method......

What I have tried:

type Backend() =
    let client = new MobileServiceClient("link to the azure table here")
    let mutable table = Unchecked.defaultof<IMobileServiceSyncTable<Items>>
member x.Initialize()=
    let path = Path.Combine(MobileServiceClient.DefaultDatabasePath,"local.db")
    let localstore = new MobileServiceSQLiteStore(path)
    do localstore.DefineTable<Items>()
    do client.SyncContext.InitializeAsync(localstore) |>Async.AwaitTask|>ignore
    do table <- client.GetSyncTable<Items>()
member x.SyncTable()
    async {
       do client.SyncContext.PushAsync() |> Async.AwaitTask |> Async.ignore
       do table.PullAsync("query", table.CreateQuery()) |> Async.AwaitTask |> ignore
    }
member x.GetTable() =
    async {
       do x.SyncTable() |> Async.RunSynchronously()
       let! result = table.ToEnumerable() |> Async.AwaitTask // the application freezes at this point.
       return new ObservableCollection<Item>(result)
    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900