microsoft / HoloJS

Provides a framework for creating holographic apps using JavaScript and WebGL.
MIT License
1.19k stars 114 forks source link

Spatial anchor read access violation #171

Open Reda-S opened 6 years ago

Reda-S commented 6 years ago

Hi Cristi,

Can you try to replicate this issue from your side: just run the example spatial-anchor.js and it will throw a read access violation on holographic.anchors.enumerateAnchors Now here is the kicker, it only throws this access violation issue on release mode (no issues on debug).

VS V15.7.3 I tried it on a HoloLens with Windows V 17134.1011 & Windows V 17686.1003

Thanks

Almost-Done commented 6 years ago

In Release mode, this line throws the exception: SpatialAnchorStore^ anchorStore = await SpatialAnchorManager::RequestStoreAsync();`

Replacing that line with create_task(SpatialAnchorManager::RequestStoreAsync()) .then([](task<SpatialAnchorStore^> previousTask)

and changing the logic of the function to execute on completion of the task makes it work, but I'd like to understand the root cause. "await" is used extensively in the project and this might be a sign of bigger issues.

Almost-Done commented 5 years ago

This section of code has been rewritten. Try this snippet of script and let me know if it still throws exceptions.


var anchorStore;
if (SpatialAnchorStore.isAvailable()) {
    anchorStore = new SpatialAnchorStore();
    anchorStore.oninitialized = function () {
    }

    anchorStore.onerror= function () {
    }

    anchorStore.initialize();
}