private BitmapSource GetIconImage(FileInfo fileN) { try { BitmapSource result = null; if (fileN.Exists) { System.Drawing.Icon ico = System.Drawing.Icon.ExtractAssociatedIcon(fileN.FullName); if (ico != null) { using (MemoryStream strm = new MemoryStream()) { ico.Save(strm); // throwing error in this line after 8000 files strm.Seek(0, SeekOrigin.Begin); IconBitmapDecoder ibd = new IconBitmapDecoder(strm, BitmapCreateOptions.None, BitmapCacheOption.Default); result = ibd.Frames[0]; } ico.Dispose(); } } return result; } catch (Exception exp) { Console.Out.WriteLine(exp.Message); return null; } }
A first chance exception of type 'System.IO.FileFormatException' occurred in PresentationCore.dll The image format is unrecognized. A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll There are no more files A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll Not enough storage is available to process this command A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll Not enough storage is available to process this command
MemoryStream
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)