wpf - Creating BitmapImage throws missing key exception -
i have view displays image it's title , comment alongside it. when load existing images utilize code:
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();
when execute endinit() throw exception missing parameter key. stack trace shows this:
@ system.collections.hashtable.containskey(object key) @ system.collections.hashtable.contains(object key) @ system.windows.media.imaging.imagingcache.removefromcache(uri uri, hashtable table) @ system.windows.media.imaging.bitmapimage.finalizecreation() @ system.windows.media.imaging.bitmapimage.endinit()
so can tell me why getting exception when using code i've seen many others use success , yet exception??? i'm @ loss!
this caused bug in wpf, in bitmapimage.finalizecreation()
:
if ((createoptions & bitmapcreateoptions.ignoreimagecache) != 0) { imagingcache.removefromimagecache(uri); }
if specify ignoreimagecache
, don't load uri, breaks.
just rid of flag; applies when loading urls.
Comments
Post a Comment