Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 5 WSA azure

Discussion in 'Windows' started by Heolix, May 3, 2015.

  1. Heolix

    Heolix

    Joined:
    Feb 19, 2014
    Posts:
    4
    I am trying to use azure web service with windows store 8.1/8.1 windows phone build.
    I created fake plugin with .net 3.5 and the real one as Class library(Windows 8.1) .
    They are placed like in WSA plugin manual(fake as editor and in Plugin folder and the real in WSA folder). They both are build by Release.
    I am using Api compatibiltiy level: .NET 2.0 and Compilation overrides: Use Net Core.
    Unity3d version 5.0.0f4

    Plugin setup:



    Fake Plugin:
    Code (csharp):
    1.  
    2. namespace Azure
    3. {
    4.     public class Connect
    5.     {
    6.         public  void insert()
    7.         {
    8.         }
    9.     }
    10. }
    11.  
    Real Plugin:
    Code (csharp):
    1.  
    2. namespace Azure
    3. {
    4.     public class Connect
    5.     {
    6.         public static MobileServiceClient MobileService = new MobileServiceClient(
    7.                  "https://testazure.azure-mobile.net/","ur password");
    8.         public async void insert()
    9.         {
    10.             TodoItem item = new TodoItem { Text = "Awesome item", Complete = false };
    11.             await MobileService.GetTable<TodoItem>().InsertAsync(item);
    12.         }
    13.     }
    14.     public class TodoItem
    15.     {
    16.         public string Id { get; set; }
    17.         public string Text { get; set; }
    18.         public bool Complete { get; set; }
    19.     }
    20. }
    21.  
    Test class:
    Code (csharp):
    1.  
    2. public class test : MonoBehaviour {
    3.  
    4.     Connect boom;
    5.  
    6.     void Start ()
    7.     {
    8.         boom = new Connect();
    9.      }
    10.     public void shoot()
    11.     {
    12.         boom.insert(); // here it crash
    13.     }
    14. }
    15.  
    When I am firing azure by clicking button I get unhandled expection in "combase.dll in Template.exe".



    When I am trying to build it on windows phone I get error too.



    Does any one have idea what is wrong? Maybe it's just Unity3d bug ?
    I'am uploading project with as zip if someone wanna figure out what is going on.
     

    Attached Files:

  2. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,673
    Hey,

    tried your project, enabled following debugging features:
    * Tools->Options->Debugging->General->Disable Enable Just My Code
    * Enable all exceptions in Debug->Exceptions menu

    run the application, skip harmless exceptions.

    Finally you should see the following errors from Azure:

    Code (csharp):
    1.  
    2. A first chance exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.DLL
    3.  
    4. Additional information: Error reading JToken from JsonReader. Path '', line 0, position 0.
    5.  
    6. If there is a handler for this exception, the program may be safely continued.
    7.  
    followed by

    Code (csharp):
    1.  
    2.  
    3. A first chance exception of type 'Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException' occurred in Microsoft.WindowsAzure.Mobile.DLL
    4.  
    5. Additional information: The request could not be completed.  (Not Found)
    6.  
    7. If there is a handler for this exception, the program may be safely continued.
    8.  
    which is probably happens because of the first exception.

    Hope that hints you what might be the error.
     
  3. Heolix

    Heolix

    Joined:
    Feb 19, 2014
    Posts:
    4
    Ok I just figured out I didn't published backend to azure services.
     
  4. Meltdown

    Meltdown

    Joined:
    Oct 13, 2010
    Posts:
    5,796
    For Azure Mobile Services .NET backend yes you need to take a code-first approach and publish from Visual Studio, which will generate all the tables in your database.