entity-frameworkazureodataazure-mobile-services

Azure Mobile app service & EF Table Column Restriction?


I am using an Azure Mobile app service with Odata and Entity Framework. I have table that has around 90 columns and it doesn't work unless i comment out some of the columns in the data model. It doesn't matter what columns I comment out a query won't work if with all the columns.

The azure mobile service debugger tells me: "An unhandled exception of type 'System.StackOverflowException' occurred in EntityFramework.dll" The odata query works fine and returns 200 ok but then the EF talking to the SQL (it's an azure sql server) has a freakout and never returns anything... until i remove some columns from the datamodel.

This is just with the datamodels and tablecontrollers defined out of the box and i'm sending queries with Postman. I have 20 other tables in this service that work perfectly. I can't find a size limit or anything base on number of columns you can use with this. Any help is awesome.

Postman gives me: "502 - Web server received an invalid response while acting as a gateway or proxy server" but that is too generic to trace. looked in all the azure logs that are possible and nothing. just said there was an error


Solution

  • After 8 months of randomly trying I actually got it working!

    Instead of returning the IQueryable directly from the helper that's built into the AzureMobileServiceServer namespace convert it to an IEnumerable, then re-select everything then change it back to an IQueryable.

    No idea why this works but it negates the stackoverflow problem that is happening otherwise. I think this adds a bit more time when syncing offline but if it works I'll take it.

    public IQueryable<ItemLibrary> GetAllItemLibrarys()
    {
        // return Query();     // !! this is the original from the table controller
        return Query().AsEnumerable()
                      .Select(s => s).AsQueryable(); //  !! replace with this
    }