Forum Xamarin.Forms

Creating a new MobileServiceClient() freezes VS and Android app.

I created a different question but it has gotten convoluted over time as I gained more insight so here is a new clean post.

So I am trying to connect to a easy table Azure service. I have followed James's tuts and had them work correctly. But now I am integrating them into my app and I broked it... when I hit the line
client = new MobileServiceClient(appUrl);
I can step to the next line
var path = "syncstore.db";
But then VS hangs for around 10 seconds and comes back and the Android app is frozen indefinitely. I have changed the order of the lines and it always freezes on the line after client = new MobileServiceClient(appUrl); So I am assuming thats the culpurit
I have this in a try catch, but it does not throw an exception.
I tested the server side with Postman calls and those work fine, both Posts and Gets.
I recently learned how to debug with Azure cloud services. But I am not getting any call to hit the server from the mobile app. Its like it hits a blackhole when MobileServiceClient() is invoked.

Here is the method in question:

public async Task InitializeAsync()
if (client?.SyncContext?.IsInitialized ?? false)

        var appUrl = "";
            client = new MobileServiceClient(appUrl);

            var path = "syncstore.db";

            var store = new MobileServiceSQLiteStore(path);


            await client.SyncContext.InitializeAsync(store);

            chatTable = client.GetSyncTable<MessageViewModel>();
        catch (Exception e)
            Debug.WriteLine("Exception thrown in Initialize: " + e);
            Debug.WriteLine("ExceptionMessage thrown in Initialize: " + e.Message);


That method has been called a multitude of different ways see my old post for more details


  • JohnButlerJohnButler USMember ✭✭

    So I finally got it to work!!! "How?" you ask. I went on 2 week vacation, came back, started a again. Copied the new URL of the tut project into my actual project, did some testing. And then this is the big thing, I then put the same address I had been using back into my app, and... it just worked.... I did NOTHING to the code, and now it seems to work... So almost a month of work time lost and all I had to do was just put a different URL in, run it, and then put the original URL back in.... Lovely. I am guessing it cleared out some weird temp file that was messing up the program or something... even though I erased the temp files countless times... I don't get it, but onward I go!

Sign In or Register to comment.