现在的位置: 首页 > 综合 > 正文

The specified buffer index is not within the buffer capacity.

2017年10月19日 ⁄ 综合 ⁄ 共 308字 ⁄ 字号 评论关闭

在对metro环境下对文件压缩测试的时候。下面的代码出现The specified buffer index is not within the buffer capacity.错误。

其中 fileToCompress 为 StorageFile。

byte[] buffer = WindowsRuntimeBufferExtensions.ToArray(await FileIO.ReadBufferAsync(fileToCompress));

解决办法:找到fileToCompress对应的文件(可以通过fileToCompress.path得到文件路径),我这是1.txt,在里面写点东西。问题解决。

我觉得可能是1.txt为0Kb的原因。

抱歉!评论已关闭.