Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Uploading this specific JSON file to the Hololens with UploadFileAsync() crashes for unknown reason #263

Open
gjrgj opened this issue Jul 31, 2017 · 8 comments

Comments

@gjrgj
Copy link

gjrgj commented Jul 31, 2017

I have attached the file in question in a .zip.To recreate the issue, unzip the folder and try uploading the file to the Hololens with the aforementioned method.

scenes.zip

@hpsin
Copy link
Contributor

hpsin commented Jul 31, 2017

What directory are you uploading it to? Or is this a HoloLens specific API?

@gjrgj
Copy link
Author

gjrgj commented Jul 31, 2017

I'm trying to upload it to the CameraRoll directory for processing it with an application - are there restrictions on what sorts of files can exist there?

@gjrgj
Copy link
Author

gjrgj commented Jul 31, 2017

Trying to upload it through the regular dev portal interface in-browser also fails but without throwing an error.

@hpsin
Copy link
Contributor

hpsin commented Jul 31, 2017

Does uploading it to any other folder also fail? I cannot reproduce this on the latest desktop, mobile or IoT builds. What version of HoloLens are you using? (RS1_release?)

@gjrgj
Copy link
Author

gjrgj commented Jul 31, 2017

Interestingly when I try to upload the file to the LocalCache folder in the specific application within LocalAppData, the upload succeeds. Could this issue have to do with permissions on public folders within the Hololens?

edit: I am using RS1_release.

@gjrgj
Copy link
Author

gjrgj commented Jul 31, 2017

I apologize for so many messages, but the issue came up again. For some reason the file uploaded fine once, and now it refuses to anymore. Here is the function I'm using for upload if it helps:

/// <summary>
        /// Uploads individual files to the Hololens for loading.
        /// </summary>
        public Task UploadFile(string fileName)
        {
            Task uploadT = new Task(
                async () =>
                {
                    await portal.UploadFileAsync("LocalAppData", fileName, "LocalCache", "prospect-hololens_1.0.0.0_x86__pzq3xp76mxafg");
                    //[NonSerialized]
                    //await portal.UploadFileAsync("CameraRoll", fileName);
                });
            uploadT.Start();
            return uploadT;
        }

        /// <summary>
        /// Click handler for the uploadFiles button.
        /// </summary>
        /// <param name="sender">The caller of this method.</param>
        /// <param name="e">The arguments associated with this event.</param>
        private void UploadFiles_Click(object sender, RoutedEventArgs e)
        {
            this.ClearOutput();
            this.EnableConnectionControls(false);
            this.EnableDeviceControls(false);

            StringBuilder sb = new StringBuilder();
            Task uploadTask = new Task(
                async () =>
                {
                    sb.Append(this.MarshalGetCommandOutput());
                    sb.AppendLine("Uploading files...");
                    this.MarshalUpdateCommandOutput(sb.ToString());

                    try
                    {
                        // get all files first
                        String folderPath = @"C:\Users\georg\AppData\Local\Temp\com.irisvr.prospect\geometry";
                        string[] files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);

                        sb.AppendLine("Files:");
                        for(int i = 0; i < files.Length; i++)
                        {
                            Debug.WriteLine(files[i]);
                            await UploadFile(files[i]);
                            
                            //FileInfo f = new FileInfo(files[i]);
                            //Debug.WriteLine(f.Length * 12 / 100000);
                            //await Task.Delay((int)(f.Length * 12 / 100000));
                            //await Task.Delay(1000);
                            sb.Append("File " + files[i] + " uploaded successfully\n");
                        }
                        
                    }
                    catch (Exception ex)
                    {
                        sb.AppendLine("Failed to upload files.");
                        sb.AppendLine(ex.GetType().ToString() + " - " + ex.Message);
                    }
                    sb.AppendLine("Uploading complete!");
                    this.MarshalUpdateCommandOutput(sb.ToString());
                });

            Task continuationTask = uploadTask.ContinueWith(
                (t) =>
                {
                    this.MarshalEnableDeviceControls(true);
                    this.MarshalEnableConnectionControls(true);
                });

            uploadTask.Start();
        }

@hpsin
Copy link
Contributor

hpsin commented Aug 3, 2017

Sorry for the delay George.

Hm, I don't know of any file permissions restrictions on CameraRoll, but don't have a HoloLens to test on. I noticed this:
// to prevent hololens from locking out network IO (I don't know why this happened, but it occurred when I used to use the CameraRoll folder
// and I don't want to risk it again)
//FileInfo f = new FileInfo(files[i]);
//Debug.WriteLine(f.Length * 12 / 100000);
//await Task.Delay((int)(f.Length * 12 / 100000));
//await Task.Delay(1000);
I don't know of anything in Device Portal that prevents it from handling multiple file uploads at once, but it's a possibility. I'll continue investigating. Does the workaround of not using CameraRoll unblock you?

@gjrgj
Copy link
Author

gjrgj commented Aug 4, 2017

Hey Hirsch, no worries. Those comments are remnants from a situation that occurred several weeks ago during development and that I fixed with a factory reset - however, I don't remember if the issue was with the specific file I was trying to upload or with IO being locked out. Probably the file.

I think Device Portal handles uploading multiple files just fine, but certain files trigger it to break for unknown reasons. I would have to do extensive testing to figure out what it is about the file that breaks.

I'm currently just using a different file as a workaround, but not using CameraRoll did not unblock me for that specific file.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants