C# 在Windows Phone 8.1中,图像未在读写模式下打开?

C# 在Windows Phone 8.1中,图像未在读写模式下打开?,c#,windows-runtime,windows-phone-8.1,winrt-xaml,C#,Windows Runtime,Windows Phone 8.1,Winrt Xaml,我正在使用FileopenPicker从PictureLibrary中选择图像,但在选择后,我无法使用FileAccessMode.ReadWrite打开它,这给了我一个异常 Windows.Storage.StorageFile.OpenAsync(FileAccessMode accessmode) 这是我在读写模式下打开文件的代码 StorageFile file = args.Files[0]; var stream = await file.OpenAsyn(FileAccessMo

我正在使用FileopenPicker从PictureLibrary中选择图像,但在选择后,我无法使用FileAccessMode.ReadWrite打开它,这给了我一个异常

Windows.Storage.StorageFile.OpenAsync(FileAccessMode accessmode)
这是我在读写模式下打开文件的代码

StorageFile file = args.Files[0];
var stream = await file.OpenAsyn(FileAccessMode.ReadWrite); // Exception occur on this line
BitmapImage bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage();
await bitmapImage.setSourceAsyc(stream);

请帮我解决这个问题。

刚刚在测试代码中试用过,它对我很有用:

  StorageFile newFile = await file.CopyAsync(ApplicationData.Current.LocalFolder, file.Name, NameCollisionOption.GenerateUniqueName);

  using (var stream = await newFile.OpenAsync(FileAccessMode.ReadWrite))
  {

  }

也许你需要将文件复制到应用程序存储中并打开它以便在那里写入?我试图复制它,但它仍然给我相同的例外,accessmode无法读取和写入,只能使用读取…:(