question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upload fails on files larger than ChunkSize (UWP)

See original GitHub issue

I use google Api with UWP project Nugets(Google.Apis 1.31.0-beta01, Google.Apis.Auth 1.31.0-beta01, Google.Apis.Drive.v3 1.30.0.1044) were installed.

I try upload file on google drive.

public async UploadAsync(string parentId, string fileName, IStorageFile inputFile, CancellationToken ct) 
{
    var body = new Google.Apis.Drive.v3.Data.File() {
        Name = fileName,
        Parents = new List<string>() { parentId }
    };
    using (var streamFile = await inputFile.OpenReadAsync()) {
        using (var stream = streamFile.AsStreamForRead()) {
            stream.Position = 0;
            var uploadRequest = _driveService.Files.Create(body, stream, inputFile.ContentType);
            uploadRequest.Fields = "id, name";
            uploadRequest.ProgressChanged += (obj) =>
            {
                    Debug.WriteLine($"sent - {obj.BytesSent}");
            };
            await uploadRequest.UploadAsync(ct);

            var file = uploadRequest.ResponseBody;
            Debug.WriteLine($"file - {file.Id}, {file.Name}");
        }
    }
}

I can only upload files < 10MB (by default). For large files(>10MB) UploadAsync doesn’t finish and obj.BytesSent always 0.

When I change uploadRequest.ChunkSize the upload limit also changes.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6

github_iconTop GitHub Comments

7reactions
chrisdunelmcommented, Jun 19, 2018

Closing as UWP is an unsupported platform. Will re-open and investigate if we add support for UWP.

0reactions
jskeetcommented, Dec 5, 2017

Okay, so this is only a problem on UWP. At the moment, UWP is an unsupported platform, but we are working on UWP support - so we’ll need to make sure this works at that point too.

10MB is the size at which the upload uses multiple chunks, so presumably the problem is somewhere there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# - upload file by chunks - bad last chunk size
2. The short answer is that you should upload n bytes, not chunkSize bytes. · Unclear where chunkSize comes out from, but it...
Read more >
Cannot transfer large files with BufferSize set to 4 MB
This happens because of two reasons: 1. There is some extra information (headers) that are passed to the server that inflate the junk...
Read more >
PRB: Cannot Upload Large Files When You Use ...
This problem occurs because the default value for the maxRequestLength parameter in the <httpRuntime> section of the Machine.config file is 4096 (4 megabytes)....
Read more >
C# UWP/WinRT FTP Large File Upload
The LargeFileUpload method is the same as PutFile, but designed to work around the following potential problem associated with an upload that is...
Read more >
Uploads/Downloads Cannot Exceed Large File Chunk Size
We have a limited workaround. We have media files that exceed 200 MB, but I'm concerned about performance implications of increasing the chunk ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found