【发布时间】:2021-09-30 17:11:01
【问题描述】:
我在 WASM 平台上使用我的 Uno 应用程序从我的网站下载图像时遇到问题。
它适用于 UWP。我的代码是:
StorageFile imageFile = await SelectedFolder.CreateFileAsync($"{item.picturekey}.jpg",
Overwrite ? CreationCollisionOption.ReplaceExisting : CreationCollisionOption.FailIfExists);
if (imageFile != null)
{
byte[] imageArray = await DataService.GetImage(item.picturekey, item.hiresurl);
if (imageArray != null)
{
var stream = await imageFile.OpenAsync(FileAccessMode.ReadWrite);
using (var outputStream = stream.GetOutputStreamAt(0))
{
using (DataWriter writer = new DataWriter(outputStream))
{
if (imageArray != null)
{
sb.AppendLine(this.DownloadStatus);
await writer.StoreAsync();
await outputStream.FlushAsync();
}
}
}
stream.Dispose();
}
}
当我针对 wasm 进行测试时,我收到:
fail: Windows.Storage.Streams.DataWriter[0]
The member DataWriter.DataWriter(IOutputStream outputStream) is not implemented in Uno.
我的 try-catch 给了我: System.NullReferenceException: Arg_NullReferenceException at Windows.Storage.Streams.DataWriter.WriteBytes[Byte[] value) ... 第 62 行
I have checked to be sure, imageArray.Length > 0, so I am not passing in a null.
I assume that it is really supported in Uno for UWP and not WASM, is there a work-around?
Thanks, any suggestions would be helpful.
【问题讨论】: