Error running in Hololens

After upgrading to 5.6 beta (and build to Universal 10, Hololens) i get some errors running in Hololens. The same happens running in the HoloLens Emulator.

Exception: Incorrect hashcode or refCount - (GCHandleToObject)
Hash: expected 23597687 was 13526506(HashCode: 13526506 BlockID: 0 HandleIdInBlock: 573), RefCount: 1
(HashCode: 13526506 BlockID: 0 HandleIdInBlock: 573), AllocatedObjectCount: 2461
MainThreadId: 4, ThisThreadId: 4
StackTrace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.InternalUtils.GetStackTrace()
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
Type: System.Exception
Module:
InnerException:
AdditionalInfo:
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.InternalUtils.GetStackTrace()
at WinRTBridge.ExceptionHandling.LogException(Exception ex, String additionalInfo)
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: Line: 0)

Exception thrown: ‘System.InvalidCastException’ in UnityEngine.dll
InvalidCastException: Unable to cast object of type ‘WinRTBridge.ScriptingPinnedArray’ to type ‘GetAsyncDelegate’.
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: Line: 0)

Jørn

Hi, Jørn.

It looks like there’s a problem with the WorldAnchorStore.GetAsync() invocation. What are you passing as a parameter?

Could you post a bug report with your project so we can take a look?

Same here, the thing is that the GetAsync method sometimes work and sometimes don’t. (I’m using the device, not the emulator).

Although the log shows an exception, i’m trying to catch it but nothing happens, and the “onComplete” delegate is also never called.

DeviceLog.txt

Loading native plugins
Loading MicStreamSelector.dll
Loading SharingClient.dll
Loading SpatialUnderstanding.dll
Loading PlaneFinding.dll
Module information:
Built with Compiler Ver ‘190023918’
Built from ‘trunk’ branch
Version is ‘5.6.0b4 (f8c731df0021)’
Release build
Application type ‘D3D11’
Used ‘UWP’
OS ‘Windows 10 (10.0.14393)’
PlayerConnection initialized from c:/data/Programs/WindowsApps/Cevisama2017_1.0.0.0_x86__pzq3xp76mxafg/Data (debug = 0)
PlayerConnection initialized network socket : 0.0.0.0 55249
Multi-casting “[IP] 192.168.0.100 [Port] 55249 [Flags] 2 [Guid] 58833841 [EditorId] 4294967295 [Version] 1048832 [Id] MetroPlayerX86(HoloLens-O0J07) [Debug] 0” to [225.0.0.222:54997]…
Started listening to [0.0.0.0:55249]
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: HoloLens Graphics (ID=0x22b0)
Vendor: Intel
VRAM: 604 MB
Initialize engine version: 5.6.0b4 (f8c731df0021)
Logical Screen DPI is 144.00.
If your machine has multiple graphics adapters, Unity may have created a WindowContext on the wrong adapter. If you experience a black screen when playing, please restart the Editor.

(Filename: C:/buildslave/unity/build/Runtime/VR/VRDevice.cpp Line: 180)

UnloadTime: 4.698737 ms
Getting Anchor Store Async…

(Filename: C:/buildslave/unity/build/artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)

Starting the observer.

(Filename: C:/buildslave/unity/build/artifacts/generated/Metro/runtime/DebugBindings.gen.cpp Line: 51)

Exception: Incorrect hashcode or refCount - (GCHandleToObject)
Hash: expected 0 was 8859792(HashCode: 8859792 BlockID: 0 HandleIdInBlock: 1646), RefCount: 0
(HashCode: 8859792 BlockID: 0 HandleIdInBlock: 1646), AllocatedObjectCount: 90
MainThreadId: 4, ThisThreadId: 4
StackTrace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
Type: System.Exception
Module:
InnerException:
AdditionalInfo:
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.ExceptionHandling.LogException(Exception ex, String additionalInfo)
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object.
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.InvokeGetAsyncDelegate(GetAsyncDelegate handler, IntPtr nativePtr)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: Line: 0)

Exception: Incorrect hashcode or refCount - (GCHandleToObject)
Hash: expected 0 was 52594082(HashCode: 52594082 BlockID: 0 HandleIdInBlock: 1663), RefCount: 0
(HashCode: 52594082 BlockID: 0 HandleIdInBlock: 1663), AllocatedObjectCount: 92
MainThreadId: 4, ThisThreadId: 4
StackTrace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
Type: System.Exception
Module:
InnerException:
AdditionalInfo:
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.ExceptionHandling.LogException(Exception ex, String additionalInfo)
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

(Filename: Line: 0)

NullReferenceException: Object reference not set to an instance of an object.
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.InvokeGetAsyncDelegate(GetAsyncDelegate handler, IntPtr nativePtr)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: Line: 0)

Setting up 1 worker threads for Enlighten.
Thread → id: 5dc → priority: 1
Trimming D3D resources.

yes, I got the same on 5.6.0b8.
WorldAnchorStore.GetAsync never gets triggered.
Just after starting the Observer when you run an app on the Device (No Remote to Device), you get this:

Assert
14:47:44 : WinRTScriptingObjectWrapper::InternalRelease Reference Count cannot be zero

Exception
14:47:44 : Exception: Incorrect hashcode or refCount - (GCHandleToObject) Hash: expected 0 was 47444408(HashCode: 47444408 BlockID: 0 HandleIdInBlock: 1635), RefCount: 0 (HashCode: 47444408 BlockID: 0 HandleIdInBlock: 1635), AllocatedObjectCount: 62 MainThreadId: 4, ThisThreadId: 4 StackTrace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.InternalUtils.GetStackTrace()
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method) Type: System.Exception Module: InnerException: AdditionalInfo: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.InternalUtils.GetStackTrace()
at WinRTBridge.ExceptionHandling.LogException(Exception ex, String additionalInfo)
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
Exception14:47:44 : NullReferenceException: Object reference not set to an instance of an object.
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.InvokeGetAsyncDelegate(GetAsyncDelegate handler, IntPtr nativePtr)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

Assert
14:47:44 : WinRTScriptingObjectWrapper::InternalRelease Reference Count cannot be zero

Assert
14:47:44 : WinRTScriptingObjectWrapper::InternalRelease Reference Count cannot be zero

Assert
14:47:44 : WinRTScriptingObjectWrapper::InternalAddRef Reference Count cannot be zero

Exception
14:47:44 : Exception: Incorrect hashcode or refCount - (GCHandleToObject) Hash: expected 0 was 20931768(HashCode: 20931768 BlockID: 0 HandleIdInBlock: 1638), RefCount: 0 (HashCode: 20931768 BlockID: 0 HandleIdInBlock: 1638), AllocatedObjectCount: 89 MainThreadId: 4, ThisThreadId: 4 StackTrace: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.InternalUtils.GetStackTrace()
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method) Type: System.Exception Module: InnerException: AdditionalInfo: at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at WinRTBridge.InternalUtils.GetStackTrace()
at WinRTBridge.ExceptionHandling.LogException(Exception ex, String additionalInfo)
at WinRTBridge.GCHandledObjects.ValidateObject(ObjectDebugInfo dbgInfo, Object o, String message)
at WinRTBridge.GCHandledObjects.GCHandleToObject(Int64 handleId)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

Exception
14:47:44 : NullReferenceException: Object reference not set to an instance of an object.
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.InvokeGetAsyncDelegate(GetAsyncDelegate handler, IntPtr nativePtr)
at UnityEngine.VR.WSA.Persistence.WorldAnchorStore.$Invoke12InvokeGetAsyncDelegate(Int64 instance, Int64* args)
at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)

Guys, we need a bug report with a repro project in order to fix this.

2 Likes