编码:
private async Task<int> Save()
{
StorageFile file = await DownloadsFolder.CreateFileAsync("a.exe");
IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite);
DataWriter writer = new DataWriter(stream);
byte[] buffer = new byte[4096];
writer.WriteBytes(buffer);
await writer.StoreAsync();
await writer.FlushAsync(); //Hang for a long time
writer.Dispose();
return 1001; //eventually it can get to this line, no exception is thrown
}
编辑:
在Win8 CP build 8250上发现,升级到build 8375后问题消失。所以我猜这是一个已经在winrt或win8中修复的错误。