The component cannot be found. (Exception from HRESULT: 0x88982F50)

10

The above exception occurs at line await bitmapImage.SetSourceAsync(fileStream); whenever I tried to retrieve image from local file.

This is the method I'm using for storing and retrieving the image file.

    public async Task<BitmapImage> RetrieveImageFromFile(String fileName)
    {
        try
        {
            StorageFile localFile = await _storageFolder.GetFileAsync(fileName + "Img");
            BitmapImage bitmapImage = new BitmapImage();
            using (IRandomAccessStream fileStream = await localFile.OpenAsync(FileAccessMode.Read))
            {
                await bitmapImage.SetSourceAsync(fileStream);
            }
            return bitmapImage;
        }
        catch(Exception e)
        {
            return null;
        }
    }

    public async void WriteImageToFile(string fileName, IRandomAccessStreamWithContentType stream )
    {
        StorageFile file = await _storageFolder.CreateFileAsync(fileName + "Img", CreationCollisionOption.ReplaceExisting);
        Stream streamToSave = stream.AsStreamForWrite();
        using (Stream fileStram = await file.OpenStreamForWriteAsync())
        {
            streamToSave.CopyTo(fileStram);
        }
    }

The input stream for the WriteImageToFile method is retrieved from contact.Thumbnail.OpenReadAsync() method

Any help ?

c#
stream
windows-runtime
windows-phone-8.1
storagefile
asked on Stack Overflow May 16, 2015 by MohanRajNK • edited May 18, 2015 by MohanRajNK

2 Answers

4

Just turning my comment into an answer since it's been helping people:

The 0x88982f50 error is generally related to a failure to read/decode an image file correctly. Verify your file is formatted properly. Google 88982f50 to see dozens of potentially related fixes, all relating to image file I/O. I never did find a definitive source for the error but this turned out to be my problem as well... Bad file.

answered on Stack Overflow Mar 28, 2017 by sraboy • edited Feb 11, 2018 by sraboy
2

Late answer but might save someone else from spending hours hunting this down...

Error code 0x88982f50 is WINCODEC_ERR_COMPONENTNOTFOUND, and it's the Windows Imaging Component's way of saying it can't decode an image file.

Most likely the file is corrupted, or the version of WIC installed in Windows doesn't include a codec needed to decode it.

Microsoft provides zero information about it.

answered on Stack Overflow Jun 21, 2019 by Ger O'Donnell

User contributions licensed under CC BY-SA 3.0