Expand fails on Client Win8.1 universal app

Topics: OData Library
Oct 14, 2014 at 12:53 AM

Just a quick question, is this not supported in a Win 8.1 universal class library? Or if it is, can anyone help with what i'm doing wrong.
When I do this from the browser or Fiddler I receive the correct response.

My code in the client client class is as follows (using the OData Client v2 code generated objects)
        var application = new UriBuilder(ServiceBaseAddress);
        var context = new Models.Application(application.Uri);

        var modulesQuery = context.Modules.Expand(m=>m.Menus).Where(m => m.Name == ApplicationName);
        var modules = await ((DataServiceQuery<Module>) modulesQuery).ExecuteAsync();
        _currentModule = modules.FirstOrDefault();
The following exception is generated on the last line

A first chance exception of type 'Microsoft.OData.Core.ODataException' occurred in Microsoft.OData.Core.DLL

Additional information: When writing a JSON response, a user model must be specified and the entity set and entity type must be passed to the ODataMessageWriter.CreateODataEntryWriter method or the ODataFeedAndEntrySerializationInfo must be set on the ODataEntry or ODataFeed that is being writen.

Thanks in advance.