Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

VS2017/U5.6 Crash - WinRTScriptingObjectWrapper::InternalAddRef Reference Count cannot be zero

Can anyone help?

I upgraded my SurfacePro from VS2015and Unity 5.1.1 to VS2017 Enterprise and Unity 5.6, and now my HoloLens crashes every time the WorldAnchorManager in HoloToolkit is accessed. I have spent many hours uninstalling and reinstalling, building against different versions of the UWP SDK, upgrading firmware, and this still happens 100% of the time. I am still running VS2015 and Unity 5.1.1 on my desktop PC, and everything works fine there.

My suspicion is that it's something in the initialisation of the WorldAnchorManager - maybe the Queue instance that is used for the Pub/Sub model, as the class can be instantiated, but never gets to Awake() or Start(). I'm even beginning to worry that it's some I/O firmware issue on my HoloLens. Output is:

WinRTScriptingObjectWrapper::InternalAddRef Reference Count cannot be zero

(Filename: C:\buildslave\unity\build\Runtime/ScriptingBackend/DotNet/ScriptingApi_DotNet.cpp Line: 661)


The program '[472] test8.exe' has exited with code -2147483645 (0x80000003).

A couple of other people have had the same thing - here are two (unsolved) posts from the Unity forum:

https://forum.unity3d.com/threads/error-running-in-hololens.449303/

https://forum.unity3d.com/threads/how-can-i-diagnose-this-crash.456837/

Comments

  • Just curious, but have you filed a bug with the unity team? From the forum post you linked to, it sounds like a problem that will have to be fixed on their end, and they are in need of a reproducer project.

  • Jimbohalo10Jimbohalo10 ✭✭✭
    edited April 2017

    When we started on in March 2016, with HoloLens, we found that developers with VS 2015 Enterprise were getting problems, that the VS Community version was not.

    The Enterprise was replaced by Community and went away, eventually VS 2015 Enterprise was fixed.

    I have been testing with VS 2017 preview (SDK 15060 wont work, but automatically installed).

    Therefore my suggestion is VS 2017 Community Standard, using 10.14393 SDK.

    I have tried VS Enterprise 90 day licence versions and for HoloLens there seems little reason to use this, due to the cost.

    The Release code in Enterprise is IMHO significantly different in VS2017, but yet again VS 2017 Preview, code is different enough to break Spectator View project and OpenCV 3.1

    There are just so many combinations could be working, for production only VS 2015 Update 3 Community seems the only version

  • I have the same problem with Visual Studio 2015. For @Jimbohalo10 . This is not in the domain of Visual Studio, this happens internally in Unity!

    @neerajwadhwa : WorldAnchorManager together with Unity 5.6.0f3 behaves erratically.
    In my case - when debugging connected to the device, breakpoints in my scripts on Update() never get reached - it crashes between Start( and Update(.
    I also observed several race conditions where the WorldAnchorStore was not ready even though it appeared to be.
    private void AnchorStoreReady(WorldAnchorStore anchorStore) - gets called in my case when debugging but after that it crashes out.

    In some cases it works on the HL but not always.
    Remoting to HL works fine, but running on HL and debugging connected to HL is broken when using WorldAnchorManager (because of the underlying WorldAnchorStorage).

    Finally (unrelated) - attaching a WorldAnchor to a GameObject - takes an undefined time to be finished - you cannot do GetComponent and start working with it. This includes accessing IsLocated property throwing an error.

  • I added a repro. Unitypackage zipped additionally to be able to upload here. ... import it, set up the project for HoloLens (do not forget to set the VR - Holographic setting), build/deploy/debug... But basically most tests that use WorldAnchorManager are failing. Unity 5.6.0f3 here. VS 2015 Enterprise.

  • @DaTruAndi said:
    I added a repro. Unitypackage zipped additionally to be able to upload here. ... import it, set up the project for HoloLens (do not forget to set the VR - Holographic setting), build/deploy/debug... But basically most tests that use WorldAnchorManager are failing. Unity 5.6.0f3 here. VS 2015 Enterprise.

    Unity 2017.1.0b1 has the same issue.
    Reverting back to 5.5.3f1 is not an option as we use 5.6 features :(

  • Jimbohalo10Jimbohalo10 ✭✭✭
    edited April 2017

    @DaTruAndi said:
    I added a repro. Unitypackage zipped additionally to be able to upload here. ... import it, set up the project for HoloLens (do not forget to set the VR - Holographic setting), build/deploy/debug... But basically most tests that use WorldAnchorManager are failing. Unity 5.6.0f3 here. VS 2015 Enterprise.

    Hi using the example AnchorTestRepo.zip you sent fails to build in Unity 5.4F3 and version 5.5F3 error at line 425 SpatialMapping.cs

    This is almost entirely due to the use of a very old version of the HoloToolkit-Unity project

    To get the updated Microsoft/HoloToolkit-Unityfor use in Unity 5.6F3

    Go to Microsoft/HoloToolkit-Unity.
    Login to GitHub.
    Click "Fork" to make your own copy of the HoloToolkit-Unity repository.

    Install and open GitHub Desktop application and set up the paths for downloaded kits.
    Close GitHub Desktop.

    Go to the your Fork/branch of HoloToolkit-Unity.

    Click on Clone and select "Open in GitHub Desktop"

    After a while the GitHub Desktop application will open and the files will download.

    When complete right click the HoloToolkit-Unity repository on Desktop and select show in File Explorer.

    In File Explorer go to .\GitHub\HoloToolkit-Unity\External\Unitypackages, in there is the package HoloToolkit-Unity-v1.5.5.0.unitypackage

    Create a new project AnchorToolkit_1_5_5, or some name you chose, Import the HoloToolkit-Unity-v1.5.5.0.unitypackage.
    Select Build and Run
    Select Windows Store, Universal 10,Target Any,D3D,SDK version 14393, Build and Run on Local Machine,Unity C#

    Selected Build successfully and Visual Studio 2015 successfully build Release, x86, HoloLens Emulator 14393

    Now Export your own original project, excluding all HoloToolkit-Unity that was in your original project and import these into the new project AnchorToolkit_1_5_5.

    You need to use Release build or you could get false Conditional Assertion errors, HoloLens installed libraries are all built as Release.

    When updates occur to the master Microsoft/HoloToolkit-Unity
    GitHub Desktop will notify you in History that changes have taken place and you can decide when to upgrade your branch.

    You probably don't need these instructions, but others might find these useful as a lot has changed in GitHub since the command line days :)

    Unity 5.6F3 is the last version to support Windows 8 (Windows Run Time) Win RT, everything will be pure UWP.
    The Windows Store no longer take Win RT based applications as of 27th January 2017.

  • DaTruAndiDaTruAndi ✭✭
    edited April 2017

    @Jimbohalo10 I do not understand your response. This is not a repro for 5.4 and 5.5. This is about a problem in Unity 5.6 and 2017 b1 - again I was not talking about 5.4 or 5.5. It works on 5.4 and 5.5 - FYI: actually Unity themselves and Microsoft were able to repro the bug based on my description.
    It is not a HoloToolkit bug - but a Unity bug. I hoped HoloToolkit might have a workaround but after looking into it the whole weekend, I do not see a way to work around it as the exception Unity throws internally cannot be caught as it never reaches your code from what I know.
    I tried workarounds as different order of operations to get the WorldAnchorStore "ready" through dummy store operations first, and any order that I could conceive - but it fails basically before that :)

    As for building failing: Funny, I was able to build it and the part of HoloToolkit that I left in should be relatively up to date - I stripped it down to as minimal as possible. If I forgot something to strip or stripped too much - sorry.
    For the error to occur for sure you need to debug and attach to the version running on the device. And I do not know why you talk about Win RT here... in the unitypackage the build settings are not stored.

    For spatial anchor handling to run stable we are currently all stuck on Unity 5.5.3f1.

  • Jimbohalo10Jimbohalo10 ✭✭✭
    edited April 2017

    I marked vote down your post because, you do not seem to have listened.

    There is currently (20/April/2017) NO official support for Unity 5.6F3 and VS2017 in HoloLens.

    This has been stated many times here. There will as always be an official announcement when official support Unity 5.6.* and VS2017 in HoloLens commences.

    Your version of Toolkit you are using in Unity 5.5.* is, according to GitHub Desktop Compare, 1,932 commits/changes behind the current Master of the HoloToolkit-Unity.

    When support for HoloToolkit-Unity appears for a later version, in 2017, of Unity 5.6.* and Visual Studio 2017, there will be a new version of the HoloToolkit, which will like previous versions will probably NOT be compatible with older prior versions.

    The problems you have with Unity code breaks should be reported to Unity Support, and use Unity Paid/Premium Support to get the problems fixed quickly.

    You are welcome to report issues with the latest version of the Microsoft/HoloToolkit-Unity at Microsoft/HoloToolkit-Unity/issues

    You may find other issues people have raised helpful.

    Disclaimer: I don't work/have any connection with Microsoft or products. The opinions expressed here are my personal opinions and not those of Microsoft

    The information given is subjective and subject to change.

    Personally this thread is now closed, therefore will not be replying any further to this thread.

  • DaTruAndiDaTruAndi ✭✭
    edited May 2017

    @Jimbohalo10 said:
    I marked vote down your post because, you do not seem to have listened.

    There is currently (20/April/2017) NO official support for Unity 5.6F3 and VS2017 in HoloLens.

    I think that response is a bit rude as it helps nobody to solve the underlying issue. It is not a VS 2017 issue, in my case this is with VS2015 - and it was not flagged as a HoloToolkit issue.

    I do not know why you take such a negative stance.

    Formal "Support" is in this case indeed an issue on the Unity site, and Unity indeed claims support for HoloLens in 5.6 - this is a forum of people trying to fix the problems they have.

    It has been tracked as a bug by Unity - and submitted by multiple individuals as a bug in Unity (and likely even verified by ppl inside Microsoft).

    UPDATE: 5/8/2017 (some time in the evening) - Unity found a bug fix and is working on integrating it into 5.6 / 2017 beta.

    Note it was not posted in a HoloToolkit forum, so your response also is not very applicable.
    The question for HoloToolkit would be if there someone finds a workaround for the time being. I doubt it meanwhile though as the bug is relatively deep in Unity.

    IMHO: It does not help the community to respond like this - but it would be helpful to work proactively and together towards a solution instead of talking about "support" and voting down.

    We all just try to get our stuff to work ;)

  • Hi, thanks this has been driving me mad for ages. I think I have being having the same problem, started a new project added sharingstage and autojoin and all is ok, but add ImportExportAnchorManager & AnchorText and the app dies on the Hololens with' WinRTScriptingObjectWrapper::InternalAddRef Reference Count cannot be zero' as it first connects.

    Using version unity 5.6.1f1 and latest released vs 2017. I thought it was in the Hololens Toolkit .. but couldn't pin it down - if its in unity that makes sense.

    Thank you for your post I can stop wasting my time.

  • DracaeDracae
    edited June 2017

    Hey, so I'm also experiencing just about the same issue:
    I'm currently building the TapToPlace scene that's included in the recently updated HoloToolKit via Unity 5.6.0f3 and VS 15 Update 3, and deploying it to the Hololens emulator.
    The project consistently deploys, but immediately 'crashes' upon deployment. After inserting breakpoints inside of the TapToPlace script and the WorldAnchorManager script, I've yet to find the reason for the errors I'm seeing. Starting to wonder if I should just give in and reinstall the recommended version of Unity (5.6.1f1) that's specified by the HoloToolKit github page, especially considering if it truly is a Unity issue...

  • I had also faced several issues with 5.6.1 Unity (World anchor issues, Model issues etc). Most of the problems had disappeared after installing Unity 5.6.2, which was released on June 21.
    https://unity3d.com/get-unity/download/archive?_ga=2.245511812.1853930520.1498272829-1691010374.1498272829

Sign In or Register to comment.