【发布时间】:2013-05-21 17:26:07
【问题描述】:
我有一个视图,它显示一个带有标题和评论的图像。 当我加载现有图像时,我使用以下代码:
this.ArtifactIdentity = image.ArtifactIdentity;
this.Comment = image.Comment;
this.Name = image.Name;
this.MediaIdentity = image.MediaIdentity;
this.ImageArray = image.Image;
Image = new BitmapImage();
Image.BeginInit();
Image.CacheOption = BitmapCacheOption.None;
Image.CreateOptions = BitmapCreateOptions.IgnoreImageCache;
Image.StreamSource = new MemoryStream(this.ImageArray);
Image.EndInit();
当我执行 EndInit() 时,它会抛出异常缺少参数键。堆栈跟踪显示:
at System.Collections.Hashtable.ContainsKey(Object key)
at System.Collections.Hashtable.Contains(Object key)
at System.Windows.Media.Imaging.ImagingCache.RemoveFromCache(Uri uri, Hashtable table)
at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation()
at System.Windows.Media.Imaging.BitmapImage.EndInit()
所以谁能告诉我为什么我在使用代码时遇到这个异常?我很茫然!
【问题讨论】:
-
确切的异常消息是什么?