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.

Unity - FileOpenPicker causes crash

In my hololens application I am trying to load a single file from onedrive. I tried to use the fileopenpicker however when I deploy my app to hololens and call the OpenFileAsync function as UnityEngine.WSA.Application.InvokeOnUIThread(()=> OpenFileAsync(), false); my app crashes and Visual Studio gives 0xc000027b error code. I tried many samples on the internet yet non of them did work. I don't know what I'm missing. Any help would be appreciated. Here is my code:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using System.Diagnostics;
 using System.Runtime.CompilerServices;
 using System.Threading;
 using System.Threading.Tasks;
 using System;
 using UnityEngine.WSA;
 using UnityEngine.UI;

     using Windows.Storage;
     using Windows.Storage.Streams;
     using Windows.Storage.Pickers;

 public class GetFile : MonoBehaviour
     public TextMesh label;

         private FileOpenPicker openPicker;

     public void CallFile()
         UnityEngine.WSA.Application.InvokeOnUIThread(()=> OpenFileAsync(), false);

     private async void OpenFileAsync()
         FileOpenPicker openPicker = new FileOpenPicker();
         openPicker.ViewMode = PickerViewMode.Thumbnail;
         openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;

         StorageFile file = await openPicker.PickSingleFileAsync();
         if (file != null)
             // Application now has read/write access to the file
             label.text = "find";
             label.text = "nope";

Best Answer


  • It may be worth upgrading to RS5 and checking out how they do the file picker without leaving the app:


  • Thanks for your answer. Turning on the pictureslibrary capability and changing the suggested start location to pictureslibrary did the job. However it's not clear how to give permisssion access to -for example- documents folder. Its weird that I can start from the pictures folder and navigate back to where I want but when I want to directly go to the folder I want, the app just crashes and I can't catch the error even with try-catch block.

  • Hi modsimmer I needed to do the same thing.. I was wondering if you could share the code you used to load files from one drive ?

Sign In or Register to comment.