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

2

12

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 ?

Unreconstructed answered 16/5, 2015 at 8:8 Comment(7)
I'm presenting the same issue... Did you find a solution?Astonied
Hopefully you've worked around this by now but 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.) This turned out to be my problem as well... Bad file.Lefevre
@Lefevre thanks, you saved a day to me :) bad files with 0 bytes size or formatting errors. we should always check if the stream was succesfully createdPomfret
have this problem on Windows UWP as well when using the ImageLib. how to you check if the stream was created succesfully? i guess just check if it is not null, and catch the potential exceptions.Westernize
@Lefevre You should turn your comment into an answer. I see this error frequently, and I am fairly sure it is caused by erroneous image data from the stream.Chungchungking
@Hong, thanks for pointing that out. I've gone ahead and answered the question.Lefevre
@Lefevre Glad to be the first to up-vote your answer.Chungchungking
L
6

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.

Lefevre answered 28/3, 2017 at 18:28 Comment(0)
P
4

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.

Paulpaula answered 21/6, 2019 at 23:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.