locked
OData Client library preview for Windows 8 Metro throwing "System.Resources.MissingManifestResourceException was unhandled by user code" RRS feed

  • Question

  • I'm using the sample available here http://blogs.msdn.com/b/phaniraj/archive/2012/04/26/developing-windows-8-metro-style-applications-that-consume-odata.aspx. When running it, after a little bit of time, right after constructing the query when it start to loop in the foreach clause following error occurs:

    System.Resources.MissingManifestResourceException was unhandled by user code  HResult=-2146233038  Message=Unable to load resources for resource file "System.Data.Services.Client" in package "effab2fb-4c27-4201-98e2-e45a2bc35d28".  Source=mscorlib  StackTrace:       at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)       at System.Data.Services.Client.TextRes.GetString(String name)       at System.Data.Services.Client.Strings.get_DataServiceException_GeneralError()       at System.Data.Services.Client.QueryResult.EndExecuteQuery[TElement](Object source, String method, IAsyncResult asyncResult)       at System.Data.Services.Client.DataServiceRequest.EndExecute[TElement](Object source, DataServiceContext context, String method, IAsyncResult asyncResult)       at System.Data.Services.Client.DataServiceContext.EndExecute[TElement](IAsyncResult asyncResult)       at NetFlixOnWindows.DataServiceContextAsyncExtensions.<>c__DisplayClass8`1.<ExecuteAsync>b__7(IAsyncResult executeAsyncResult) in c:\Users\Marius\Downloads\Windows8ODataSample\NetFlixOnWindows\DataServiceContextAsyncExtensions.cs:line 27       at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)  InnerException: 

    Any other ideas on how can I connect to OData WCF Data Service? How are people really developing actual applications when data access is an issue, by doing only Syndication Feeds and Web Requests?

    Thank you in advance,

    C:\Marius

    Wednesday, May 9, 2012 8:46 PM

Answers

  • The latest release of Visual Studio 2012 RC works perfectly now, no need to download external assemblies and even to generate your own proxy classes as even the "Add Service Reference" works now.

    Nevertheless thank for all respondents,

    C:\>Marius

    • Marked as answer by C. MariusMVP Thursday, July 26, 2012 11:49 AM
    Thursday, July 26, 2012 11:49 AM

All replies

  • Hi,

    It seems the issue cannot be reproduced at my side.

      >> right after constructing the query when it start to loop in the foreach clause following error occurs

    Looks like there’s an issue loading resources for System.Data.Services.Client. It would be better if you can check whether your .NET framework is correctly installed.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Thursday, May 10, 2012 6:36 AM
    Moderator
  • Are you calling ExecuteAsync on the query first?

    Thursday, May 10, 2012 11:41 AM
  • As I mentioned i'm using 100% the same example from Phani Raju, no changes whatsoever. I'm also running a Windows 8 CP, only with visual studio 2011 simply installed after configuring IIS.

    I guess i could re-install Windows 8 to make sure, but before launching myself into destroying my VHD i wanted to have the confirmation that the issue is reproducible or not!

    Thank you again,
    C:\Marius

    Thursday, May 10, 2012 2:13 PM
  • The code that gets executed is as follows 

    var query = (DataServiceQuery<Genre>)this.Context.Genres.Take(100);

    var query = (DataServiceQuery<Genre>)this.Context.Genres.Take(100);
    
                var downloadedGenres = await query.ExecuteAsync();
    
                foreach (Genre genre in downloadedGenres)
                {
                    Uri requestUri = new Uri(string.Format("Genres('{0}')/Titles?$top=1&$filter=( (BoxArt/HighDefinitionUrl ne null or BoxArt/LargeUrl ne null) and Rating eq 'PG' )", genre.Name), UriKind.Relative);
                    var tileTitles = await this.Context.ExecuteAsync<Title>(requestUri);
                    if (tileTitles.Any())
                    {
                        genre.Titles.Add(tileTitles.First());
                    }
                }

    The ExecuteAsync<Title> method is further defined as follows:

     public static async Task<IEnumerable<TResult>> ExecuteAsync<TResult>(this DataServiceContext context, Uri requestUri)
            {
                var executeTask = Task.Factory.FromAsync<IEnumerable<TResult>>(context.BeginExecute<TResult>(requestUri, null, null),
                           (executeAsyncResult) =>
                           {
                               var executeResult = context.EndExecute<TResult>(executeAsyncResult).ToList();
                               return executeResult;
                           });
    
                return await executeTask;
            }

    Thursday, May 10, 2012 2:16 PM
  • Hi ,

    Thanks for bringing this to our attention, I'll take a look at this and see why the client library is throwing these errors.

    [Edit 1 ] The MissingManifestResourceException exception is the .net runtime complaining about being unable to access error message strings, I've updated the downloadable files in my blog past, please redownload the application and the client binaries to fix this issue.


    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj


    Thursday, May 10, 2012 6:37 PM
  • I was having similar issues in a seperate project.  I added the updated binaries and now get this trying to build,

    System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Data.Edm.Metro, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
    File name: 'Microsoft.Data.Edm.Metro, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)

    The Zone of the assembly that failed was:
    MyComputer
       at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

    Thursday, May 10, 2012 7:45 PM
  • Thank you for your quick reply, however I must say that the same issue mentioned here below by Tron occurs on my system too.

    I've also realized (please confirm) that the original issue occurred every time there seemed to be an issue with content retrieval (e.g. occasional I couldn't access Netflix, or my own service was malfunctioning).

    Thank you for updating again the solution package,

    C:\Marius

    Thursday, May 10, 2012 8:37 PM
  • Same here, one second it would work then it wouldn't.
    Thursday, May 10, 2012 8:48 PM
  • Hi,

    I am trying to reproduce this issue, but failed. Since now this is a strong name validation error, please try to configure the application to bypass strong name validation:

    <runtime>
         < bypassTrustedAppStrongNames enabled="false" />
      </runtime>

    If it doesn't help, maybe Phani can provide further suggestions.

    Best Regards,

    Ming Xu.


    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework

    Monday, May 14, 2012 9:23 AM
    Moderator
  • I didn't see a way to bypass in the application.  I'm bypassing by running the sn -Vr command.  The project builds, but throws this error.

    System.TypeInitializationException was unhandled by user code
      HResult=-2146233036
      Message=The type initializer for 'System.Data.Services.Client.TypeSystem' threw an exception.
      Source=Microsoft.Data.Services.Client.Metro
      TypeName=System.Data.Services.Client.TypeSystem

    ...

      InnerException: System.IO.FileNotFoundException
           HResult=-2147024894
           Message=The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
           Source=Microsoft.Data.Services.Client.Metro
           StackTrace:
                at System.Data.Services.Client.TypeSystem..cctor()
           InnerException:

      
    Wednesday, May 16, 2012 2:04 PM
  • I'm getting this problem as well. Is there such a thing as app.config in a metro style app? If not, where do we put the above snippet?


    D

    Thursday, May 24, 2012 12:01 AM
  • Hi guys,

    Any chance of this working with the Windows 8 Release Preview and Visual Studio 2012 Release Candidate? I'm trying it here, but, no chance to make it work... It complains about not being able to load type RuntimeReflectionExtensions...

    Could not load type 'System.Reflection.RuntimeExtensions.RuntimeReflectionExtensions' from assembly 'System.Reflection.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.":"System.Reflection.RuntimeExtensions.RuntimeReflectionExtensions


    André Alves de Lima
    Microsoft MVP - Client App Dev
    Visite o meu site: http://www.andrealveslima.com.br
    Me siga no Twitter: @andrealveslima

    Friday, June 1, 2012 1:41 PM
  • Hello.

    I am getting the same error just by calling the WCF Services

    Could not load file or assembly 'Microsoft.Data.Services, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

    .

    I have tried every tick on the book,

    from including all server DLLs (copy local) to uploading the full bin folder into the IIS folder

    I've also tried adding the right DLLs using Nuget.. 

    but still no lock

    please help

    Regards



    Tuesday, June 12, 2012 9:09 PM
  • Hi Tron, I was getting this exact error.

    I went searching for the DLL and found it in my DEBUG folder, so I referenced it there from vsnet2012RC.

    All good now.

    I'm running Win8RC, VSNET2012RC x64.

    Hope this helps,

    Mick.


    Mick Badran - http://blogs.breezetraining.com.au/mickb

    Wednesday, June 13, 2012 1:16 PM
  • So guys,

    Regarding the use of odata on Release Preview, I found out by this post that simply adding a service reference pointing to the odata contract works perfectly...

    http://samidipbasu.com/2012/06/13/wiring-up-odata-usage-from-windows-8-metro-app/

    So, no need to external dlls anymore, it simply works...


    André Alves de Lima
    Microsoft MVP - Client App Dev
    Visite o meu site: http://www.andrealveslima.com.br
    Me siga no Twitter: @andrealveslima

    Saturday, June 16, 2012 7:31 PM
  • The latest release of Visual Studio 2012 RC works perfectly now, no need to download external assemblies and even to generate your own proxy classes as even the "Add Service Reference" works now.

    Nevertheless thank for all respondents,

    C:\>Marius

    • Marked as answer by C. MariusMVP Thursday, July 26, 2012 11:49 AM
    Thursday, July 26, 2012 11:49 AM
  • Hi all!

    I had issues with WCF Data Services for Windows Store Apps. The package installed direct from Microsoft did not have a strong name but by following the instructions from the website below I was able to add the references that have strong names.

    http://www.damirscorner.com/WCFDataServicesToolsForWindowsStoreAppsAndNuGetPackageRestore.aspx

    I have added this comment here as when I researched this was the only link that was close to my issue.

    • Proposed as answer by Paul Caesar Friday, December 7, 2012 12:30 AM
    Friday, December 7, 2012 12:30 AM