microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

Access Denied using Sharing Service + Holographic Remoting #274

Closed markgrossnickle closed 7 years ago

markgrossnickle commented 8 years ago

I am getting an access denied for the WorldAnchorTransferBatch ExportAsync.

This only happens in Holographic Remoting. It works fine if remoting is not active (both device and editor).

The world anchor has been saved... just fails to export.

// Save the anchor to our local anchor store. if (anchorStore.Save(exportingAnchorName, anchor)) { sharedAnchorInterface = new WorldAnchorTransferBatch(); sharedAnchorInterface.AddWorldAnchor(guidString, anchor); WorldAnchorTransferBatch.ExportAsync(sharedAnchorInterface, WriteBuffer, ExportComplete); } else { Debug.Log("This anchor didn't work, trying again"); currentState = ImportExportState.InitialAnchorRequired; }

Here is the stack trace on the error: SpatialAnchorTransferManager denied access to WorldAnchor serialization 0x00000001414DD7FB (Unity) StackWalker::GetCurrentCallstack 0x00000001414DF4AE (Unity) StackWalker::ShowCallstack 0x00000001414AE583 (Unity) GetStacktrace 0x00000001411B7A7B (Unity) DebugStringToFile 0x00000001411B7EEC (Unity) DebugStringToFile Which sound similar to this post https://forums.hololens.com/discussion/1549/access-denied-on-world-anchor-export but I am saving successfully prior to the export call.

I also tried enabling every capability to ensure it was not a permissions issue though I think those may only trigger on deployment (not sure).

StephenHodgson commented 8 years ago

I thought the world anchor store is not supported on desktop or editor.

Did the new 5.5 beta change this?

I don't have the 5.5 beta though, so I can't test this out.

NeerajW commented 8 years ago

Yeah worth trying out on an older build. Good call. It has worked for me in the editor before but I'm not sure how helpful it is since it will have no tracking information.

markgrossnickle commented 8 years ago

@HodgsonSDAS WorldAnchorStore GetAsync completes successfully for the Editor while Remoting.

markgrossnickle commented 8 years ago

@NeerajW Doesn't the remoting device provide all of the tracking information?

StephenHodgson commented 8 years ago

Sounds like I need to update to 5.5, but I was holding off until the actual release

markgrossnickle commented 8 years ago

@HodgsonSDAS For what it is worth, it does not complete if you are just using the editor. It only completes if you are remoting through the editor.

StephenHodgson commented 8 years ago

yeah, I figured as much. Probably passes in the anchor store from the device.

NeerajW commented 8 years ago

Makes sense.

markgrossnickle commented 8 years ago

Back to the issue though... any thoughts? I don't have access to under the hood of WorldAnchorTransferBatch to get an idea of what is failing.

At Taqtile we are trying to use remoting to display higher resolution models on the device in a shared experience.

Assuming this is a bug and not a user error, Is this something that should/will be addressed or should I explore other avenues?

Another route I've considered is to use the HoloLensCompanionKit but I'm not sure how feasible that would be to tie into an UWP build exported from Unity. And even if I did get it integrated successfully I am wondering if I will hit the same AccessDenied issue as I can't tell if this error is coming as a result of running in the editor or if it is a permissions issue in that no remoting host will be able to serialize spatial data from the remoting device.

StephenHodgson commented 8 years ago

Repo steps?

Do you have a test project you can share with us?

markgrossnickle commented 8 years ago

I can't share this one... but I'll work on re-creating in a sample this afternoon.

StephenHodgson commented 8 years ago

Totally understand. Yeah and example scene should be sufficient.

markgrossnickle commented 8 years ago

Posted a project here.

Let me know if you have issues downloading and I can tweak permissions.

All I did was create a new project, drop in latest hololens, and wire up some of the base prefab/components. The only code I changed was to add some additional logs.

I dropped a cube in the scene but at this point nothing visual is necessary.

To reproduce run this in 5.5. Have a sharing session running. Enable remoting. The app will connect but then fail to serialize the anchor as discussed above.

In case link is broken:: https://drive.google.com/file/d/0B-WNtodAE0QpbW0taG5oUlVKNHc/view?usp=sharing

StephenHodgson commented 8 years ago

Yeah, I get web blocked by work. No change you can't just post it here on Git?

markgrossnickle commented 8 years ago

It was over 10mb. Here is just the assets folder... hopefully you can just drop it in a project.

Assets.zip

NeerajW commented 8 years ago

I could repro this issue with HoloToolkit-Unity Sharing test scene.

  1. Anchor creation worked.
  2. Anchor got located.
  3. Anchor got saved.
  4. Export gave SpatialAnchorTransferManager denied access to WorldAnchor serialization.

Will follow up internally.

StephenHodgson commented 8 years ago

Sorry for the delay, had priority work items to do. After getting 5.5b I was able to repo as well.

NeerajW commented 8 years ago

Hi Everyone

Import/Export of Anchors is not a supported scenario with Unity Remoting. Best not to take a dependency on remoting for shared scenarios.

@markgrossnickle please close when you are ready.

Thanks, Neeraj.

timothyt commented 7 years ago

That's a bummer. So no intention to support this in future?

StephenHodgson commented 7 years ago

@markgrossnickle What we've done in the past is when we're in the editor, to just calculate anchor from origin. Still can't use Anchors, but we do use the transform data where needed. It's not perfect but it's a decent enough work around I guess.

janatuerlich2015 commented 7 years ago

Import/Export of Anchors is not a supported scenario with Unity Remoting. Best not to take a dependency on remoting for shared scenarios.

Is this also true for the non-Unity HoloToolkit.Sharing project? I am trying to share anchors while remoting, and SpatialAnchorTransferManager::RequestAccessAsync() gives me SpatialAnchorTransferManager::DeniedBySystem although I think I have set up the spatialPerception capability successfully. Another strange thing is that SpatialSurfaceObserver::RequestAccessAsync() results in SpatialAnchorTransferManager::Allowed. How can this happen, as the access requesting methods depend on the same capability (spatialPerception)?

I would be so grateful for anyone pointing me into the right direction!

DominicBoettger commented 7 years ago

When running the SharingWithUUNET Demoscene i get this Output (captured with VS Debugger when running the app on the Hololens):

exporting 738d2a98-c532-47fd-9afa-27f3cc574c88

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

SpatialAnchorTransferManager denied access to WorldAnchor serialization

(Filename: C:/buildslave/unity/build/Runtime/VR/HoloLens/WorldAnchor/WorldAnchorTransferBatch.cpp Line: 256)

If i run the uunet demo as app on the hololens without Debugging i see the textmessage Server (not anchored) which maybe is caused by the debugging output above.

ljDevelopment commented 6 years ago

@markgrossnickle What we've done in the past is when we're in the editor, to just calculate anchor from origin. Still can't use Anchors, but we do use the transform data where needed. It's not perfect but it's a decent enough work around I guess.

Can anybody go further on what "calculate anchor from origin" means?

Is this to align Hololens in the position when launching the app?

In our tests, SpatialMapping object always is positionend in (0, 0, 0), refered to the initial position when launching the app.