windows-phone-8.1 – 如何避免StorageFile.CopyAsync()在复制大文件时抛出异常?

我将通过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()

如何导入大文件,是否有解决此问题的解决方案?

我会尝试通过缓冲区复制它 – 例如像这样:
private 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;
}

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...