Search Unity

Could not load file or assembly Windows.Foundation.UniversalApiContract

Discussion in 'Windows' started by PixelSquad, Nov 16, 2015.

  1. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Morning guys

    I'm trying to implement an in app purchase plugin on Windows 10. Whenever I call
    CurrentApp.LoadListingInformationAsync(), I get the following exception:

    Code (csharp):
    1. Exception thrown: 'System.IO.FileNotFoundException' in Assembly-CSharp.dll
    2. Exception: Could not load file or assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    3. Type: System.IO.FileNotFoundException
    4. Module: CrimeCoastWindowsPlugins
    5. InnerException: <No Data>
    6. AdditionalInfo:<No Data>
    7.    at OnePF.WP8.Store.DeliverPendingPurchases()
    8.    at Game.$Invoke23(Int64 instance, Int64* args)
    9.    at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
    I wonder if this is something that was removed on Windows 10 Universal, and if there's a workaround for it.

    Many thanks
     
  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Which Unijty version (exactly) are you using?
     
  3. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Hi there, I'm using 5.2.2p2. Thanks for your reply.
     
  4. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Bump. Anyone had this problem before? Many thanks.
     
  5. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,681
    I believe I encountered this issue a few weeks ago, and it's been fixed internally for 5.3. Is this something that you'd need to be available for 5.2, or would it be fine for you to move up to 5.3 when it gets released in a week?
     
  6. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Hi Tautvydas. Thanks for your answer. We can't upgrade to 5.3, so I'd appreciate it if you could make it available as a patch for 5.2.

    This is the last thing that's pending the release of the soft launch of our game on Windows 10. Just out of interest, do have an idea of when the patch will be available? (Or do you know if there's something I could do to work around the problem?)

    Many thanks and all the best
     
  7. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,681
    If you marked that plugin as don't process, it should work.

    If we decided to include it into a patch, it would take 1.5-2 weeks to arrive to a patch release.
     
  8. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Thanks Tautvydas.

    I've checked the "Don't process" checkbox, and now some of the methods where it used to crash are no longer crashing. However, I get the following while trying to create the .appxupload file, do you think it might be related to it being marked as "don't process"?

    ...

    C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.CurrentApp' was not included in compilation, but was referenced in method 'Store.Inventory.get()'. There may have been a missing assembly.

    C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.Inventory.get()' will always throw an exception due to the missing method 'CurrentApp.get_LicenseInformation()'. There may have been a missing assembly.

    C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.LoadListingsImpl(string[])' will always throw an exception due to the missing method 'CurrentApp.LoadListingInformationAsync()'. There may have been a missing assembly.

    C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.PurchaseProduct(string, string)' will always throw an exception due to the missing method 'CurrentApp.RequestProductPurchaseAsync(string)'. There may have been a missing assembly.

    C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.DeliverPendingPurchases()' will always throw an exception due to the missing method 'CurrentApp.get_LicenseInformation()'. There may have been a missing assembly.

    C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.ConsumeProduct(string, Guid)' will always throw an exception due to the missing method 'CurrentApp.ReportConsumableFulfillmentAsync(string, Guid)'. There may have been a missing assembly.

    ...
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,681
    I don't think these are related. And chance you could post the full build log that was printed to VS output in a [ CODE ] block?
     
  10. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Here it goes:

    Code (csharp):
    1.  
    2. ------ Build started: Project: Crime Coast, Configuration: Master x64 ------
    3.   UnityInstallationDir "C:\Program Files\Unity\Editor".
    4.   UnityWSAPlayerDir "C:\Program Files\Unity\Editor\Data\PlaybackEngines\metrosupport".
    5.   UnityProjectDir "C:\Users\will\Desktop\CrimeCoast\gc.unity".
    6.   Copying unprocessed assemblies...
    7.   Running AssemblyConverter...
    8.   AssemblyConverter done.
    9.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast.exe
    10.   Starting .NET Native compilation
    11. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1485,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'UnityEngine'.
    12. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1485,5): warning : Could not find assembly 'Windows.Foundation.FoundationContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    13. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1485,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    14. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1759,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'UnityEngine'.
    15. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1759,5): warning : Could not find assembly 'Windows.Foundation.FoundationContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    16. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1759,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    17. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1777,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'UnityEngine'.
    18. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1777,5): warning : Could not find assembly 'Windows.Foundation.FoundationContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    19. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(1777,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    20.   Processing application code
    21. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(562,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'UnityEngine'.
    22. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(562,5): warning : Could not find assembly 'Windows.Foundation.FoundationContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    23. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(562,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    24. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(562,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'UnityEngine'.
    25. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(562,5): warning : Could not find assembly 'Windows.Foundation.FoundationContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    26. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(562,5): warning : Could not find assembly 'Windows.Foundation.UniversalApiContract, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' referenced by 'CrimeCoastWindowsPlugins'.
    27. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Invalid IL detected in method 'System.Int64 UnityEngine.Internal.$MethodUtility.$Invoke2259(System.Int64, System.Int64*)' at IL offset 0xB referring to invalid Windows Runtime method 'Windows.Foundation.HResult Windows.Foundation.IAsyncInfo.ErrorCode.get()'.
    28.   Computing application closure and generating interop code
    29.   Generating serialization code
    30.   Compiling interop code
    31. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.Foundation.AsyncOperationCompletedHandler`1' was not included in compilation, but was referenced in type 'OnePF.WP8.RatingSystem'. There may have been a missing assembly.
    32. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.Foundation.IAsyncOperation`1' was not included in compilation, but was referenced in method 'RatingSystem.<Go>b__0(IAsyncOperation<bool>, AsyncStatus)'. There may have been a missing assembly.
    33. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.Foundation.AsyncStatus' was not included in compilation, but was referenced in method 'RatingSystem.<Go>b__0(IAsyncOperation<bool>, AsyncStatus)'. There may have been a missing assembly.
    34. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.PurchaseResults' was not included in compilation, but was referenced in type 'OnePF.WP8.Store'. There may have been a missing assembly.
    35. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.ListingInformation' was not included in compilation, but was referenced in method 'Store.<>c__DisplayClass1.<LoadListingsImpl>b__0(IAsyncOperation<ListingInformation>, AsyncStatus)'. There may have been a missing assembly.
    36. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.ProductLicense' was not included in compilation, but was referenced in type 'OnePF.WP8.Store+<>c__DisplayClass6'. There may have been a missing assembly.
    37. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.FulfillmentResult' was not included in compilation, but was referenced in method 'Store.<>c__DisplayClassc.<ConsumeProduct>b__a(IAsyncOperation<FulfillmentResult>, AsyncStatus)'. There may have been a missing assembly.
    38. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Package' was not included in compilation, but was referenced in method 'RatingSystem.Go()'. There may have been a missing assembly.
    39. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'RatingSystem.Go()' will always throw an exception due to the missing method 'Package.get_Current()'. There may have been a missing assembly.
    40. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.Foundation.IAsyncInfo' was not included in compilation, but was referenced in method 'RatingSystem.<Go>b__0(IAsyncOperation<bool>, AsyncStatus)'. There may have been a missing assembly.
    41. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'RatingSystem.<Go>b__0(IAsyncOperation<bool>, AsyncStatus)' will always throw an exception due to the missing method 'IAsyncInfo.get_Status()'. There may have been a missing assembly.
    42. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.CurrentApp' was not included in compilation, but was referenced in method 'Store.Inventory.get()'. There may have been a missing assembly.
    43. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.Inventory.get()' will always throw an exception due to the missing method 'CurrentApp.get_LicenseInformation()'. There may have been a missing assembly.
    44. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.LoadListingsImpl(string[])' will always throw an exception due to the missing method 'CurrentApp.LoadListingInformationAsync()'. There may have been a missing assembly.
    45. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.PurchaseProduct(string, string)' will always throw an exception due to the missing method 'CurrentApp.RequestProductPurchaseAsync(string)'. There may have been a missing assembly.
    46. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.DeliverPendingPurchases()' will always throw an exception due to the missing method 'CurrentApp.get_LicenseInformation()'. There may have been a missing assembly.
    47. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.ConsumeProduct(string, Guid)' will always throw an exception due to the missing method 'CurrentApp.ReportConsumableFulfillmentAsync(string, Guid)'. There may have been a missing assembly.
    48. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.<PurchaseProduct>b__3(IAsyncOperation<PurchaseResults>, AsyncStatus)' will always throw an exception due to the missing method 'IAsyncInfo.get_Status()'. There may have been a missing assembly.
    49. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Type 'Windows.ApplicationModel.Store.ProductListing' was not included in compilation, but was referenced in method 'Store.<>c__DisplayClass1.<LoadListingsImpl>b__0(IAsyncOperation<ListingInformation>, AsyncStatus)'. There may have been a missing assembly.
    50. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.<>c__DisplayClass1.<LoadListingsImpl>b__0(IAsyncOperation<ListingInformation>, AsyncStatus)' will always throw an exception due to the missing method 'IAsyncInfo.get_Status()'. There may have been a missing assembly.
    51. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.<>c__DisplayClass8.<DeliverPendingPurchases>b__5(IAsyncOperation<string>, AsyncStatus)' will always throw an exception due to the missing method 'IAsyncInfo.get_Status()'. There may have been a missing assembly.
    52. C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\x64\ilc\IlcInternals.targets(886,5): warning : Method 'Store.<>c__DisplayClassc.<ConsumeProduct>b__a(IAsyncOperation<FulfillmentResult>, AsyncStatus)' will always throw an exception due to the missing method 'IAsyncInfo.get_Status()'. There may have been a missing assembly.
    53.   Cleaning up unreferenced code
    54.   Generating native code
    55.   Generating fixups for native code
    56.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_x64_Master.appx
    57.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Upload\Crime Coast_1.8.6.0_x64_Master.appx
    58.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\AppPackages\Crime Coast_1.8.6.0_Master\Crime Coast_1.8.6.0_x64_Master.appxsym
    59.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_scale-100.appx
    60.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_scale-125.appx
    61.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_scale-140.appx
    62.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_scale-150.appx
    63.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_scale-180.appx
    64.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\bin\x64\Master\Crime Coast_1.8.6.0_scale-400.appx
    65.   Crime Coast -> _scale-100.appx
    66.   Crime Coast -> _scale-125.appx
    67.   Crime Coast -> _scale-140.appx
    68.   Crime Coast -> _scale-150.appx
    69.   Crime Coast -> _scale-180.appx
    70.   Crime Coast -> _scale-400.appx
    71.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\AppPackages\Crime Coast_1.8.6.0_Master_Test\Crime Coast_1.8.6.0_x86_x64_Master.appxbundle
    72.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\AppPackages\Crime Coast_1.8.6.0_Master\Crime Coast_1.8.6.0_x86_x64_Master.appxbundle
    73.   Crime Coast -> C:\Users\will\Desktop\CrimeCoast\gc.vsproject.wsa\Crime Coast\AppPackages\Crime Coast_1.8.6.0_x86_x64_bundle_Master.appxupload
    74.   Your package has been successfully created.
    75. ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
    76. A package has been successfully built for Master (x86).
    77. A package has been successfully built for Master (x64).
    78. ========== Package: 2 succeeded, 0 failed ===========
    79. An app bundle has been successfully built for Master (x86), Master (x64).
    80. ========== App Bundle: 1 succeeded, 0 failed ===========
    81.  
    82.  
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,681
    Doesn't seem like it worked. Just to get this clear: you did mark "CrimeCoastWindowsPlugins.dll" as "don't process"?
     
  12. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Hi Tautvydas. Sorry - yes you were right - I checked that box by mistake. I'm having loads of little problems trying to get the IAP's to work, I got a bit lost in the way :) Although the IAP's are still not working on win10, the original problem of this thread seems to be resolved. Thanks for your help.
     
  13. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,681
    Great, I'm glad that's solved. The backport from 5.3 for the fix is not trivial - do you think you still need it? I'd prefer to not do it.
     
  14. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    I don't think so. But, just to let you know, the other problem I'm trying to solve is, out of the API that's available for IAPs on Win10, there are two functions that will be called in order:

    LoadListingInformationAsync
    RequestProductPurchaseAsync

    The first one works fine, while I get an "AccessViolationException" any time I try and call the second one. It doesn't seem related to me, however, I thought it might be worth confirming with you before saying we don't need the fix.

    Thanks again
     
  15. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,681
    Aren't these Windows API functions? You're not passing nulls to it, are you? You might also need to call it from Windows UI thread.
     
  16. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    UI Thread. Yes, that was it - it works now! Thanks for the help - saved me a few hours here!