- Home /
 
               Question by 
               unity_IH9g3mUvgrBIcg · Jul 24, 2018 at 01:33 PM · 
                filefilestream  
              
 
              Hololens FileOpenPicker Problem,Hololens FileOpenPicker Crashes App
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;
 
 #if ENABLE_WINMD_SUPPORT
     using Windows.Storage;
     using Windows.Storage.Streams;
     using Windows.Storage.Pickers;
 #endif
 
 public class GetFile : MonoBehaviour
 {
     public TextMesh label;
 
 #if !UNITY_EDITOR
         private FileOpenPicker openPicker;
 #endif
 
 
     public void CallFile()
     {
 #if !UNITY_EDITOR
         UnityEngine.WSA.Application.InvokeOnUIThread(()=> OpenFileAsync(), false);
 #endif
     }
 
 
 
 #if !UNITY_EDITOR
     private async void OpenFileAsync()
     {
         FileOpenPicker openPicker = new FileOpenPicker();
         openPicker.ViewMode = PickerViewMode.Thumbnail;
         openPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
         openPicker.FileTypeFilter.Add(".txt");
     
         StorageFile file = await openPicker.PickSingleFileAsync();
         if (file != null)
         {
             // Application now has read/write access to the file
             label.text = "find";
         }
         else
         {
             label.text = "nope";
         }
     }
 #endif
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Importing files from a path via C# script 0 Answers
File paths on Android 0 Answers
File saving error 1 Answer
Serialize XML File Delete and CreateNew 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                