Windows 스토어 앱을 통해 파일을 다운로드하는 데 문제가 있습니다. 이 원인이 될 수있는 어떤Windows 스토어 앱에서 파일 다운로드
An exception of type 'System.InvalidOperationException' occurred in ListStalkerWin8.exe but was not handled in user code
WinRT information: A method was called at an unexpected time.
Additional information: A method was called at an unexpected time.
:이 예외가 표시된 줄에
private static async void DownloadImage()
{
HttpClient client = new HttpClient();
HttpResponseMessage message = await client.GetAsync("http://coolvibe.com/wp-content/uploads/2010/05/scifiwallpaper1.jpg");
StorageFolder myfolder = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile sampleFile = myfolder.CreateFileAsync("image.jpg", CreationCollisionOption.ReplaceExisting).GetResults();// this line throws an exception
byte[] file = await message.Content.ReadAsByteArrayAsync();
await FileIO.WriteBytesAsync(sampleFile, file);
var files = await myfolder.GetFilesAsync();
}
: 여기 다운로드 내 방법? 당신은 IAsyncOperation에 GetResults를 호출하고
thnku very much Mario Stoilov와 Chris W.이 문제로 침몰하고있었습니다. – FebinDonz