Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Email large attachments cannot be fully uploaded after upgrading to .net Graph SDK 5.x. #2092

Closed
yunbozhang-msft opened this issue Aug 23, 2023 · 20 comments · Fixed by microsoftgraph/msgraph-sdk-dotnet-core#719
Assignees
Labels

Comments

@yunbozhang-msft
Copy link

Describe the bug

We are using Azure China cloud, now we are facing an issue that email large attachments(You can test >20M) cannot be fully uploaded after upgrading to .net Graph SDK 5.x.

We tested if change back to SDK 4.x, work fine. And if upload a small file to an email attach, also work fine.

We are following this sample code: microsoftgraph/msgraph-snippets-dotnet: Repository of snippets in Microsoft Graph .NET SDK documentation. (github.com)

And after running this sample code, we found if upload large file attachment to Public Azure, upload can be fully uploaded, but if changed to Azure China cloud, because the SDK cuts the large file into many slices when uploading a large file, only one slice can be uploaded.

So, I think this issue may be caused by 2 reasons:

1、Azure China Graph API server issue, maybe not support uploading large file?
2、SDK does not good support Azure China, not good to support uploading large attachments in Azure China.

Do you have any idea about this case, could you help take a look, thanks!

To Reproduce
Steps to reproduce the behavior:
We are following this sample code: microsoftgraph/msgraph-snippets-dotnet: Repository of snippets in Microsoft Graph .NET SDK documentation. (github.com)

Expected behavior
A large file can be fully uploaded as an attachment.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Windows
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22] 5.x

Additional context
Add any other context about the problem here.

@andrueastman
Copy link
Member

Thanks for raising this @zhangyunbo1994

Any chance you can share more details on the specific error you receive when making uploading the file? It would be great if you could also share more specifics on the runtime environment as well.

@yunbozhang-msft
Copy link
Author

Hi @andrueastman No more error messages to share with you as the upload stops after a part of the upload.

@andrueastman
Copy link
Member

Thanks for raising this @zhangyunbo1994

Any chance you can follow the guidance here on logging requests to confirm whether the requests are being sent out or responses are failing?

@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

1 similar comment
@microsoft-github-policy-service
Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@GeoffreyYue1
Copy link

I can also reproduce the same issue when upload large file attachment to gallatin mailboxes
The Authurityhost is https://login.chinacloudapi.cn, Graph baseurl is https://microsoftgraph.chinacloudapi.cn/v1.0

When we upload the large file it will discontinue after send the first part data
image

@andrueastman
Copy link
Member

Any chance the issue still occurs if you change the second line to include the optional adapter parameter as below?

var fileUploadTask = new LargeFileUploadTask<FileAttachment>(uploadSession, fileStream, maxSliceSize, graphClient.RequestAdapter)

@GeoffreyYue1
Copy link

Still the same issue after adding RequestAdapter parameter

image

The file upload session url is https://partner.outlook.cn/api/V2.0

@andrueastman
Copy link
Member

Any chance you can follow the guidance here on logging requests to confirm whether the requests are being sent out or responses are failing?
Alternatively, do you have any logs/traces of the requests?

@GeoffreyYue1
Copy link

I captured a fiddler log, in the upload session request, we can see it sends the first part of the attachment, request succeed and responsed NextExpectedRanges, but Graph SDK didn't continue upload the next range
image

@andrueastman
Copy link
Member

@GeoffreyYue1 Any chance you can confirm the response status code from the fiddler trace?
Also, just to confirm, when the upload no longer resumes, does the program exit or does it hang/stall?

@GeoffreyYue1
Copy link

@andrueastman The response code is 200, then the upload no longer continue and program just exit, no exception throw.

image

@andrueastman
Copy link
Member

Thanks for confirming @GeoffreyYue1.
Are you by any chance able to share the same trace/alternative screenshot when the upload is NOT done to a mailbox in china cloud?
The one thing I notice is that the NextExpectedRanges looks to be represented as string property while it should be a string array according to the spec at https://learn.microsoft.com/en-us/graph/outlook-large-attachments?tabs=http#response-3

image

If this is the case, it would explain the issue here.

@GeoffreyYue1
Copy link

Hi @andrueastman
The NextExpectedRanges is the same when upload the same large file to Global O365 mailbox, but it successfully continued to upload the rest parts.
image

@andrueastman
Copy link
Member

Thanks for the info here @GeoffreyYue1

Looks like the casing for NextExpectedRanges is different for the two cases. One is camel cased while the other is pascal cased causing the issue. We'll make a fix for this to handle both scenarios.

@andrueastman andrueastman self-assigned this Sep 1, 2023
@GeoffreyYue1
Copy link

Thanks @andrueastman, please let me know when the fixed build is available for testing.

@andrueastman
Copy link
Member

@GeoffreyYue1 Any chance you can add a reference to https://www.nuget.org/packages/Microsoft.Graph.Core/3.0.11-preview.1 and confirm if this fixes it for you?

@GeoffreyYue1
Copy link

Thanks @andrueastman , the issue fixed in 3.0.11-preview.1, we can successfully upload the large attachments to 21v mailbox, may I know when we can get the public build which include this fix?

@andrueastman
Copy link
Member

Thanks for confirming. This should be available soon after microsoftgraph/msgraph-sdk-dotnet-core#720 is merged.

@GeoffreyYue1
Copy link

Wonderful! Thanks for the quick response.

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

Successfully merging a pull request may close this issue.

3 participants