【发布时间】:2013-12-20 13:33:04
【问题描述】:
我收到了这个错误
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Windows.Media.Imaging.BitmapSource.SetSourceInternal(Stream streamSource)
当我尝试加载这样的图像时:
webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
webClient.OpenReadAsync(new Uri("http://zomerparkfeest.nl/uploads/" + currentItem.photo), webClient);
在 opReadAsync 中:
private void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
if (e.Error == null && !e.Cancelled)
{
BitmapImage bitMapImage = new BitmapImage();
bitMapImage.SetSource(e.Result);
image.Source = bitMapImage;
loadingImagePBar.Visibility = Visibility.Collapsed;
imageLocked = false;
}
}
我并不总是得到这个异常,它主要是在加载了很多图像之后。有什么问题?
【问题讨论】:
标签: windows-phone-8 windows-phone webclient indexoutofboundsexception