Mian--Exc:System.NotSupportedException: 未找到适用于完成此操作的图像处理组件。 ---> System.Runtime.InteropServices.COMException: 无法找不到组件。 (异常来自 HRESULT:0x88982F50)
--- 内部异常堆栈跟踪的结尾 ---
在 System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle)
在 System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache)
在 System.Windows.Media.Imaging.BitmapImage.FinalizeCreation()
在 System.Windows.Media.Imaging.BitmapImage.EndInit()
string path = string.Format("{0}\\Temp\\chinaidcard\\zp.bmp", System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData));
BitmapImage BitImage = new BitmapImage();
if (File.Exists(path))
{
BitImage.BeginInit();
BitImage.CacheOption = BitmapCacheOption.OnLoad;
using (Stream ms = new MemoryStream(File.ReadAllBytes(path)))
{
BitImage.StreamSource = ms;
BitImage.EndInit();
BitImage.Freeze();
}
}
看是不是包导入错误了.导致类不支持操作
System.Runtime.InteropServices.COMException,你引用了第三方的com组件,可能不兼容或者在计算机上没有正确注册,检查下,重新引用看看。
using去掉,你释放掉ms,BitmapImage就也会跟着释放,则会报这个错误
大佬怎么解决的,求告知。