我将通过StorageFile.CopyAsync()方法将一些文件从视频库复制到我的应用程序存储,但如果文件的大小超过1GB,则会抛出异常,如下所示:
Type: System.Runtime.InteropServices.COMException Message: Error
HRESULT E_FAIL has been returned from a call to a COM component.
Stacktrace: at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
我会尝试通过缓冲区复制它 – 例如像这样:
原文链接:https://www.f2er.com/windows/363450.htmlprivate async Task CopyBigFile(StorageFile fileSource,StorageFile fileDest,CancellationToken ct) { using (Stream streamSource = await fileSource.OpenStreamForReadAsync()) using (Stream streamDest = await fileDest.OpenStreamForWriteAsync()) await streamSource.CopyToAsync(streamDest,1024,ct); return; }