Graph 5.x Download large file over 2GB have issue
Describe the bug Graph 5.x Download large file over 2GB have issue When I trying to use graph DriveItem/Content to download large file content, I see the error below.
System.Net.Http.HttpRequestException: Cannot write more bytes to the buffer than the configured maximum buffer size: 2147483647.
Stack Trace:
HttpClient.2 errorMapping, CancellationToken cancellationToken)
ContentRequestBuilder.GetAsync(Action1 requestConfiguration, CancellationToken cancellationToken)
GraphDriveService.DownloadFileByIdAsync(String driveId, String driveItemId, RangeHeaderValue range, String eTag, CancellationToken cancellationToken) line 59
GraphDriveService.DownloadFileByIdAsync(String driveId, String driveItemId, CancellationToken cancellationToken) line 31
GraphDriveServiceTests.DownloadFileTest3() line 87
ThreadOperations.ExecuteWithAbortSafety(Action action)
To Reproduce Use Graph SDK to download drive file over 2GB
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
@dev-tony-hu, I think the developers on this repo are going to say to use the 'download a large file from OneDrive' method.
I'm guessing you're receiving this error because the underlying HttpClient is sending the request with the default parameter of HttpCompletionOptions.ResponseContentRead meaning the entire response is buffered. I don't believe there is a way to override this so you'd need to drop back to using HttpClient directly.
See also:
- https://stackoverflow.com/a/18720862/1259408
- https://www.stevejgordon.co.uk/using-httpcompletionoption-responseheadersread-to-improve-httpclient-performance-dotnet
@andrueastman - Do you have an estimate in which version will this fix be released in?
It seems the bug is fixed, right?