Reading a .xml file from a shared folder on Hololens 2

VHololenser 1 Reputation point

I've been trying to access an xml file on a shared folder using the samba share methode without any succes.

I declared the right capabilities and also added 'file type association' to my Package.appxmanifest as it shows in the screenshot

    <Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="AppLauncherml.App">  
      <uap:VisualElements DisplayName="AppLauncherml" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="AppLauncherml" BackgroundColor="transparent">  
        <uap:DefaultTile ShortName="AppLauncher" Wide310x150Logo="Assets\Wide310x150Logo.png" />  
        <uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#FFFFFF" />  
          <uap:Rotation Preference="landscape" />  
          <uap:Rotation Preference="landscapeFlipped" />  
          <uap:Rotation Preference="portrait" />  
          <uap:Rotation Preference="portraitFlipped" />  
        <uap:Extension Category="windows.fileTypeAssociation">  
          <uap:FileTypeAssociation Name="readxml">  
              <uap:FileType ContentType="application/xml">.xml</uap:FileType>  
            <uap:EditFlags AlwaysUnsafe="true"/>  
        <uap:Extension Category="windows.shareTarget">  
          <uap:ShareTarget Description="xml">  
    <uap:Capability Name="enterpriseAuthentication" />  
    <Capability Name="internetClient" />  
    <Capability Name="internetClientServer" />  
    <Capability Name="privateNetworkClientServer" />  
    <uap2:Capability Name="spatialPerception" />  
    <DeviceCapability Name="webcam" />  
    <DeviceCapability Name="proximity" />  
    <DeviceCapability Name="microphone" />  
    <DeviceCapability Name="gazeinput" />  

the using Windows.Storage and Windows.Storage.Streams are writen inside of an ENABLE_WINMD_SUPPORT

using System;  
using System.IO;  
using System.Threading.Tasks;  
using UnityEngine.UI;  
using System.Windows;  
using System.Collections;  
using System.Collections.Generic;  
using Windows.Storage;  
using Windows.Storage.Streams;  

My shared folder accepts connexions from 'Guests' which has all the permissions and 'Everyone' which has the read capability both on my shared folder options and on the 'manage' section on 'My computer' , i followed the instruction on a microsoft guide.

here's the portion of my code responsible for reading the xml file;

public class XML : MonoBehaviour  
XmlDocument XmlData = new XmlDocument();  
void Start()  
async public void LoadXml(XmlDocument XmlData)  
    XmlData.PreserveWhitespace = true;  
//StorageFolder file = await Node.GetNode(@"\NetworkShare\ConfigFile.xml");  
    StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(@"\\\NetworkShare");  
    StorageFile file = await folder.GetFileAsync("ConfigFile.xml");    
    string[] BtnTexte = new string[10];  
     if (file != null)  
         //using (Stream stream = await file.OpenAsync())  
        using (Stream stream = await file.OpenStreamForReadAsync())             
           // XmlData = await Task.Run(() => XmlDocument.Load(stream));  
            XmlElement root = XmlData.DocumentElement;  
            XmlNodeList elemList = root.GetElementsByTagName("name");  

My aim is to read the xml file and create buttons on my Hololens project depending on the data on the xml file.

Im also doing some research on how to debug my project, as i can't use the 'attach to unity debugger' even tho i know my Hololens ip and port and the 'Debug already installed app' from my C# project doesn't trigger any of my break points.

HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
233 questions
{count} votes