0
代碼:保存到Downloads文件夾,DataWriter.FlushAsync掛起90秒
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發現建8250,升級後建8375,問題消失了。所以我想這是一個在winrt或win8中修復的bug。
我打電話從處理此方法爲按鈕的點擊事件。 – kennyzx
而操作系統版本是Windows 8消費者預覽版,編譯8250. – kennyzx
你是否在後臺線程上執行此操作?這可能導致掛起時調用異步winrt apis –