Hololens deployment not working "You're integrating from APP thread, call item directly instead."

Hi’

I’m trying to implement ActiveNick Holobot (from here : GitHub - ActiveNick/HoloBot: HoloBot is a reusable 3D interface that allows HoloLens & VR users to interact with any bot using Mixed Reality & Speech.) on Hololens.

After numerous problem from different versions of Unity, Visual Studio and HoloToolkit, I’m now set with the following :

Visual Studio 15.4.1
Unity 2017 1.1f1
Sources from MixedRealityToolkit-Unity for Unity 2017.1.1f1

I’ve managed to correct all builds error from not anymore supported methods and everything seems fine on VS side after building from Unity, where the project works correctly in emulator.

When I deploy on Hololens, the app freeze the system after the disapperance of the unity logo, I need to lock/unlock the headset to unfreeze it.

So I wanted to try on debug mode to search for the problem.
At this moment no error come out from VS but the console indicate me this :

Several times

RenderTexture.GenerateMips failed: render texture does not have mip maps (set useMipMap to true).
(Filename: C:\buildslave\unity\build\Runtime/Graphics/RenderTexture.cpp Line: 847)

I understood this was a minor issue.

But at the end, I also got this message :

You're integrating from APP thread, call item directly instead.
(Filename: C:\buildslave\unity\build\PlatformDependent/MetroPlayer/AppCallbacks.cpp Line: 455)


The program '[5400] HoloBot.exe' has stopped with error -2147483645 (0x80000003).

And so far, I haven’t been able to find what was the problem and how to solve it.

Does anyone have an idea about this ?

Thanx a lot

If you only get the AppCallbacks issue to repro with the HoloBot project, it sounds like it could be an issue with the scripts in that repo calling InvokeOnAppThread when already running on the app thread.

I just dug through the scripts a bit, there’s one spot that seems particularly problematic as far as that’s concerned - at the bottom of MicrophoneManager.DictationRecognizer_DictationResult, there’s a call to InvokeOnAppThread:

UnityEngine.WSA.Application.InvokeOnAppThread(() =>
{
    // Display captions for the question
    captionsManager.SetCaptionsText(result);
}, false);

This only seems like an issue because SetCaptionsText looks like this:

UnityEngine.WSA.Application.InvokeOnAppThread(() =>
{
    // Display captions if they are enabled
    captions.text = (isCaptionsOn) ? message : "";
}, false);

So the code that’s already running on the app thread has its own call to InvokeOnAppThread - I would try removing the InvokeOnAppThread call from MicrophoneManager.DictationRecognizer_DictationResult (just call SetCaptionsText directly) and see if that helps.

First, thanx a lot for your answer !

Second, I tried to apply your suggestion but unfortunately, it doesn’t change anything apparently, app’s still freezing hololens when released on it, and same error appeared when in debug mode :confused:

I wanted to circle back since I’m the author of HoloBot and ran into the same issue when I recently migrated the project from Unity 5.6 to 2017.2. First, you are right that I had a duplicate nested call to InvokeOnAppThread and I cleaned that up. Thanks for pointing it out.

Regarding the lock-up/freeze issues that remained, the problem was threading related probably due to the new SynchronizationContext that Unity put in 2017.x to support async/await in C# 6. I was calling my Bot Service async Task StartConversation in the Awake method of the MicrophoneManager, and I was calling Task.Wait(), which for some reason doesn’t work in Unity, whereas using await on the task does. I simply made Awake an async method and awaited my Task and now it works fine.

The updated 2017.2 version of HoloBot is up on GitHub at GitHub - ActiveNick/HoloBot: HoloBot is a reusable 3D interface that allows HoloLens & VR users to interact with any bot using Mixed Reality & Speech. and I’ll be making more changes in the days and weeks to come.