WindowsDevicePortalWrapper
WindowsDevicePortalWrapper copied to clipboard
Upload errors on Windows build 203xxx
From Tadashi Tsuyuki via slack:
Hello, Recently, we got report of errors uploading a file to the HoloLens2 app's LocalState folder. Our software uses the Windows Device Portal API to upload files. When I tried it with the emulator, I got an error with versions 10.0.20348.1007 and 10.0.20346.1002. 10.0.19041.1154 and 10.0.19041.1136 work fine. Is there a solution? Thanks. Exception information RequestUri {http://XXX.XXX.XXX.XXX/api/filesystem/apps/file?knownfolderid=LocalAppData&path=/LocalState&packagefullname=XXXXX_1.0.0.0_x86__pzq3xp76mxafg} Reason Missing extraction flag from http request Source WindowsDevicePortalWrapper StatusCode System.Net.HttpStatusCode.BadRequest Stack Trace at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Tools.WindowsDevicePortal.DevicePortal.<UploadFileAsync>d__47.MoveNext()
Same issue here (for all folders on the HoloLens2 and only uploading files - installing apps, etc. works fine). Uploading files using Chrome, Firefox, ... (by Windows Device Portal) also fails (using Edge will still work to upload files) Only solution for now is to downgrade/ hold the HoloLens2 to/ at 10.0.19041.1154. Hope there will be a fix on the HoloLens2 (or a lot of clients?) soon.
Uploading files via browsers was a known issue. Please follow the workaround documented at https://docs.microsoft.com/en-us/hololens/hololens-troubleshooting#device-portal-file-uploaddownload-times-out until you receive the next HoloLens OS update (10.0.19041.1157 or newer, or 10.0.2048.1010 or newer).
Hello,
We're having the very same issue with versions 2004, 20H2 and 21H1. @pbarnettms 's proposed workaround above works fine for fixing the file explorer feature (including file upload/download) in the Devive Portal Web Interface, but, when trying to use the Device Portal API in a c# program to upload files, we are still getting that obscure
BadRequest Reason Missing extraction flag from http request
response...
Code extract :
public void UploadRequest(string fileFullPath,string appSubDirectoryName)
{
RestRequest request = new RestRequest("/api/filesystem/apps/file");
request.Parameters.Add(new Parameter("knownfolderid", "LocalAppData", ParameterType.QueryString));
request.Parameters.Add(new Parameter("packagefullname", packageFullName, ParameterType.QueryString));
request.Parameters.Add(new Parameter("path", "\\LocalState\\" + appSubDirectoryName + "\\", ParameterType.QueryString));
request.AlwaysMultipartFormData = true;
request.Timeout = 100 * 1000;
request.AddHeader("Accept-Encoding", "gzip,deflate");
request.AddFile("file", fileFullPath);
request.AddHeader("X-CSRF-Token", csrfToken);
request.Method = Method.POST;
var response = client.Post(request);
Debug.WriteLine("Device Portal response : " + response.StatusCode + " | " + response.Content); // Displays BadRequest | "Reason" : "Missing extraction flag from http request"
}
This used to work fine before Windows Holographic version 2004 . Are we missing something here ? Some kind of new header that shall be included in http requests ?
The error is saying that your request is missing the "extract" querystring parameter. It must be present and set to "true" or "false". Set it to "true" if the file is a .zip file that you want extracted after upload.