Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[assistant] Runnable/RESTConnector error at runtime when building for Lumin OS (Magic Leap) #553

Closed
LF opened this Issue Apr 2, 2019 · 6 comments

Comments

3 participants
@LF
Copy link

commented Apr 2, 2019

Hi! I'm trying to test a few Watson services (mainly Speech-To-Text and Assistant) on a Magic Leap One device, but I encounter a strange error when trying to connect to these at runtime. (This issue focuses on the minimum reproducible steps to connect to the Assistant service, as the same seems to happen for Speech-To-Text.)

Steps to reproduce

Here's what I'm using:

  • Magic Leap One Creator Edition (Lumin OS v0.95 and MLSDK v0.20.0)
  • Unity v2019.1.0b9
    • Scripting Runtime Version: .NET 4.x Equivalent
    • App Compatibility Level: .NET 4.x
    • Full logging
  • IBM Watson Unity SDK v2.15.4 from the repo's Releases page

I'm using v2.15.4 because a library I intend to use with this SDK currently works with this version.

My scene is set up with a GameObject, and the following Logic.cs attached, which was modeled after the "Supplying the IAM API key" example in the v2.15.4 README.md

using System.Collections;
using System.Collections.Generic;
using IBM.Watson.DeveloperCloud.Connection;
using IBM.Watson.DeveloperCloud.Services.Assistant.v1;
using IBM.Watson.DeveloperCloud.Utilities;
using UnityEngine;

public class Logic : MonoBehaviour {
  
  private Credentials credentials;
  private Assistant assistant;
  
  private void Start() {
    StartCoroutine(TokenExample());
  }
  
  private IEnumerator TokenExample() {
    
    var iamTokenOptions = new TokenOptions { IamApiKey = "[REDACTED]" };
    credentials = new Credentials(iamTokenOptions, "https://gateway.watsonplatform.net/assistant/api");
    
    while (!credentials.HasIamTokenData()) {
      yield return null;
    }
    
    assistant = new Assistant(credentials) { VersionDate = "2018-02-16"};
    assistant.ListWorkspaces(OnListWorkspaces, OnFail);
    
  }
  
  private void OnFail(RESTConnector.Error error, Dictionary<string, object> customData) {
    Debug.Log($"Failed to list workspaces: {error.Response}");
  }
  
  private void OnListWorkspaces(WorkspaceCollection response, Dictionary<string, object> customData) {
    Debug.Log($"Found {response.Workspaces.Count} workspaces");
  }
  
}

Expected behavior

In play mode, I see my success debug message "Found # workspaces" in the editor console. I expect to see the same in the device logs.

Actual Behavior

Instead of seeing either of my debug messages, this error shows up when the scene starts:

04-01 16:52:38.314  2111     1 E Unity   : ArgumentException: oldValue is the empty string.
04-01 16:52:38.314  2111     1 E Unity   :   at UnityEngine.Playables.PlayableDirector.SendOnPlayableDirectorStop () [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at System.String.ReplaceInternal (System.String oldValue, System.String newValue) [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at System.String.Replace (System.String oldValue, System.String newValue) [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at IBM.Watson.DeveloperCloud.Connection.RESTConnector.AddHeaders (System.Collections.Generic.Dictionary`2[TKey,TValue] headers) [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at IBM.Watson.DeveloperCloud.Connection.RESTConnector+<ProcessRequestQueue>d__33.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at IBM.Watson.DeveloperCloud.Utilities.Runnable+Routine.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0 
04-01 16:52:38.314  2111     1 E Unity   :   at UnityEngine.GridLayout.DoNothing () [0x00000] in <00000000000000000000000000000000>:0

I'm aware that building for Lumin OS may not be supported at this time (hopefully that's not the case), and that this may be an issue caused by Magic Leap instead. This is the first time I've seen this error, and I've successfully built several Unity projects to a Magic Leap device.

Thanks for any help you can provide!

@mediumTaj

This comment has been minimized.

Copy link
Collaborator

commented Apr 2, 2019

Can this be reproduced using the Magic Leap simulator? We don't have access to a headset.

@mediumTaj mediumTaj added the support label Apr 2, 2019

@mediumTaj

This comment has been minimized.

Copy link
Collaborator

commented Apr 2, 2019

Also does Magic leap support .NET framework 4.x (scripting runtime version and api compatibility level)?

@LF

This comment has been minimized.

Copy link
Author

commented Apr 2, 2019

I've tested it in the simulator, and unfortunately this issue can't be reproduced as it's running in the editor environment, which works as expected. Additionally, the other projects I've built use both the .NET 4.x scripting runtime and framework, so from my experience Magic Leap seems to support them.

For now I'll be focusing on other parts of my project, and continue troubleshooting on the side or wait for a fix in the v3 releases. (I'm currently having different issues with v3 in the same environment/build target which are a bit more difficult to pinpoint/document and aren't related to this issue.)

@mediumTaj mediumTaj added the blocked label Apr 2, 2019

@mediumTaj

This comment has been minimized.

Copy link
Collaborator

commented Apr 2, 2019

Labeling as blocked since we don't have a Magic Leap headset to investigate. @LF Please keep us updated if you make any progress on this issue and feel free to write up a PR if you find a solution.

@mamoonraja

This comment has been minimized.

Copy link
Member

commented Apr 22, 2019

@LF Can you confirm if we can close this one now?

@LF

This comment has been minimized.

Copy link
Author

commented Apr 22, 2019

@mamoonraja Hi! This issue can be closed, as the library we intended to use (with v2.15.4) has been deprecated. We'll start implementing our own using v3.x going forward, and I'll be sure to let you know if any issues come up. Thank you!

@LF LF closed this Apr 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.