OneDrive / onedrive-sdk-csharp

OneDrive SDK for C#! https://dev.onedrive.com
Other
294 stars 143 forks source link

ChunkedUpload Error: BasePostMethodRequestBuilder not found #184

Closed fridoo closed 7 years ago

fridoo commented 7 years ago

I think there is a compatibility issue with Microsoft.Graph.Core: 1.2.1.

The code example from https://github.com/OneDrive/onedrive-sdk-csharp/blob/master/docs/chunked-uploads.md on line:

var session = await oneDriveClient.ItemWithPath(uploadPath).CreateSession().Request().PostAsync();

throws the following exception on my system:

System.TypeLoadException occurred HResult=-2146233054 Message=Could not load type 'Microsoft.Graph.BasePostMethodRequestBuilder1' from assembly 'Microsoft.Graph.Core, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Source=Microsoft.OneDrive.Sdk TypeName=Microsoft.Graph.BasePostMethodRequestBuilder1 StackTrace: at Microsoft.OneDrive.Sdk.ItemRequestBuilder.CreateSession(ChunkedUploadSessionDescriptor item) at Z.zOneDrive.VB$StateMachine_23_UploadInMultipleChunksAsync.MoveNext() in C:\Users\Admin\documents\visual studio 2015\Projects\Z\Z\ServiceManager\zOneDrive.vb:line 272 InnerException:

I presume this has something to do with a resent renaming in Microsoft.Graph.Core: https://github.com/microsoftgraph/msgraph-sdk-dotnet/commit/9405292f8218c10ec4e5369cb4a91fbc9a4130ef

Is this a bug or is something wrong with my setup?


Used libraries:

(Nuget.org states that Microsoft.OneDriveSDK v2.0.3 is compatible with Microsoft.Graph.Core >= 1.1.1)

fridoo commented 7 years ago

On a side note Shouldn't the example code be: ... await oneDriveClient.Drive.Root.ItemWithPath(uploadPath).CreateSession().Request().PostAsync(); instead of ... await oneDriveClient.ItemWithPath(uploadPath).CreateSession().Request().PostAsync(); ?

cdmayer commented 7 years ago

Thank you for submitting. Looks like there is an issue with Graph 1.2.1. Looking into it now, will report back when I figure out the issue.

cdmayer commented 7 years ago

Fix submitted in https://github.com/OneDrive/onedrive-sdk-csharp/pull/185. Updated package on the way to Nuget shortly. I'll close this when the new package is added.

cdmayer commented 7 years ago

Check out the new package: https://www.nuget.org/packages/Microsoft.OneDriveSDK/2.0.4