You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Which service(blob, file) does this issue concern?
File
Which version of the SDK was used?
2.04
On which platform were you using? (.Net Framework version or .Net Core version, and OS version)
.Net Framework
How can the problem be reproduced? It'd be better if the code caused the problem can be shared.
Retrieving the initial checkpoint from context: TransferCheckpoint checkpoint = context.LastCheckpoint;
Serializing checkpoint to file:
IFormatter formatter = new BinaryFormatter();
using (FileStream fileStream = new FileStream(serializedCheckpointFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
formatter.Serialize(fileStream, checkpoint);
Deserializing checkpoint from file:
IFormatter formatter = new BinaryFormatter();
TransferCheckpoint deserializedCheckpoint;
using (FileStream fileStream = new FileStream(serializedCheckpointFilePath, FileMode.Open, FileAccess.Read, FileShare.None))
deserializedCheckpoint = formatter.Deserialize(fileStream) as TransferCheckpoint;
Getting context and setting the bytes progress tracker:
Note: GetSingleTransferContext is GetDirectoryTransferContext if uploading directory
Progress<TransferStatus> p = new Progress<TransferStatus>();
p.ProgressChanged += ( sender, status) => Console.WriteLine($"Bytes Transferred: {status.BytesTransferred}");
context = GetSingleTransferContext(checkpoint, p);
Using either TransferManager Upload Method: Task UploadAsync(string sourcePath,CloudFile destFile, UploadOptions options, SingleTransferContext context, CancellationToken cancellationToken) (upload options: null) Task<TransferStatus> UploadDirectoryAsync(string sourcePath,CloudFileDirectory destFileDir,UploadDirectoryOptions options, DirectoryTransferContext context, CancellationToken cancellationToken) (upload directory options: recursive set to true)
What problem was encountered?
I have been trying to separately persist to file the states of both a file and directory upload to file share. Using samples/DataMovementSamples/DataMovementSamples/Samples.cs as a guide, I capture the last checkpoint, serialize it to file, deserialize it, then use it in the respective upload function. However, the upload itself does not appear to resume where it left off. Instead, it seems to start over every time. Interestingly, the running BytesTransferred does appear to be persisted, as that number picks up where it left off. By the end of the upload, the final BytesTransferred is intialBytesUploaded + size of the file/directory.
When I used the same process without serialization (just taking the checkpoint, reconstructing the context, and uploading), everything worked as expected (BytesTransferred = size of the file/directory).
My guesses are that I am either doing something wrong with the serialization, not setting an option somewhere before or after the persistence, or that this is not even possible. No matter the case, any help that can be provided is much appreciated.
The text was updated successfully, but these errors were encountered:
Which service(blob, file) does this issue concern?
File
Which version of the SDK was used?
2.04
On which platform were you using? (.Net Framework version or .Net Core version, and OS version)
.Net Framework
How can the problem be reproduced? It'd be better if the code caused the problem can be shared.
Retrieving the initial checkpoint from context:
TransferCheckpoint checkpoint = context.LastCheckpoint;
Serializing checkpoint to file:
Deserializing checkpoint from file:
Getting context and setting the bytes progress tracker:
Note: GetSingleTransferContext is GetDirectoryTransferContext if uploading directory
Using either TransferManager Upload Method:
Task UploadAsync(string sourcePath,CloudFile destFile, UploadOptions options, SingleTransferContext context, CancellationToken cancellationToken)
(upload options: null)Task<TransferStatus> UploadDirectoryAsync(string sourcePath,CloudFileDirectory destFileDir,UploadDirectoryOptions options, DirectoryTransferContext context, CancellationToken cancellationToken)
(upload directory options: recursive set to true)What problem was encountered?
I have been trying to separately persist to file the states of both a file and directory upload to file share. Using samples/DataMovementSamples/DataMovementSamples/Samples.cs as a guide, I capture the last checkpoint, serialize it to file, deserialize it, then use it in the respective upload function. However, the upload itself does not appear to resume where it left off. Instead, it seems to start over every time. Interestingly, the running BytesTransferred does appear to be persisted, as that number picks up where it left off. By the end of the upload, the final BytesTransferred is intialBytesUploaded + size of the file/directory.
When I used the same process without serialization (just taking the checkpoint, reconstructing the context, and uploading), everything worked as expected (BytesTransferred = size of the file/directory).
My guesses are that I am either doing something wrong with the serialization, not setting an option somewhere before or after the persistence, or that this is not even possible. No matter the case, any help that can be provided is much appreciated.
The text was updated successfully, but these errors were encountered: