Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

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.

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, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

Using System.Threading in hololens application

I'm trying to rebuild an application I'd already made to a hololens application using Unity. When trying to build it I get about 30 errors telling me " error CS1061: 'Thread' does not contain a definition for 'Start' " and "error CS1061: 'Stream' does not contain a definition for 'Close' " etc.
They are included in the project and the application runs fine in the editor.
Can I not use threading or streams in hololens applications?

Tagged:

Best Answer

  • Options
    PatrickPatrick mod
    Answer ✓

    These APIs will work in the Editor because the Editor is not a UWP app. What is built for HoloLens is a UWP app. For some operations in UWP apps namespaces/class names have changed. Threading, networking, and storage are the ones that have been the most impactful to me.

    What I usually end up doing is having non-UWP code inside #if UNITY_EDITOR blocks and UWP code inside #if !UNITY_EDITOR blocks.

    The HoloToolkit has some classes that have examples of this you can look at. In particular:
    SpatialMapping\Scripts\MeshSaver.cs => Tasks, Storage
    SpatialMapping\Scripts\RemoteMeshSource.cs
    SpatialMapping\Scripts\RemoteMeshTarget.cs => Networking

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

Answers

  • Options
    PatrickPatrick mod
    Answer ✓

    These APIs will work in the Editor because the Editor is not a UWP app. What is built for HoloLens is a UWP app. For some operations in UWP apps namespaces/class names have changed. Threading, networking, and storage are the ones that have been the most impactful to me.

    What I usually end up doing is having non-UWP code inside #if UNITY_EDITOR blocks and UWP code inside #if !UNITY_EDITOR blocks.

    The HoloToolkit has some classes that have examples of this you can look at. In particular:
    SpatialMapping\Scripts\MeshSaver.cs => Tasks, Storage
    SpatialMapping\Scripts\RemoteMeshSource.cs
    SpatialMapping\Scripts\RemoteMeshTarget.cs => Networking

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • Options

    Ah, that makes sense. Thank you so much for explaining it so clearly!

Sign In or Register to comment.