Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Type Provider hangs app when loading data from localhost

ScottNimrodScottNimrod USMember ✭✭
edited January 2017 in Xamarin.Android

I have reason to believe that the type provider that I'm using is hanging my app on the Android emulator.

On my main page within a Xamarin.Forms app, I have the following load operation:

protected override void OnAppearing()
    return; // Never gets reached when using Type Provider...

My viewmodel has the following load operation:

public void Load() => Cars = new ObservableCollection<Car>(getCars());

My F# code is the following:

open FSharp.Data

[<Literal>]      (* "" is the workaround IP address for local host *)
let JsonPathDesignTime = "http://localhost:48213/api/cars"
let JsonPathRunTime =    ""
type Repository =         JsonProvider<JsonPathDesignTime>

type Car = { Make:string ; Model:string }

let getCars() =

        Repository.Load JsonPathRunTime
        |> Array.toSeq
        |> x -> { Make=x.Make ; Model=x.Model })

    with error -> failwith error.Message

I did not observe any exceptions thrown with the code above. However, return to the client caller does NOT occur.


If I don't use a Type Provider, but instead return an empty sequence, then the app does NOT hang.


type Car = { Make:string ; Model:string }

let getCars() : Car seq =
Sign In or Register to comment.