The component cannot be found (0x88982f50) when constructing a BitmapImage from a file URI

0

My program is loading a BitmapImage from file using the Uri constructor for use in a WPF image. This works perfectly fine on my machine (and on most user's machines), but one of my users is getting an exception when constructing the BitmapImage from the following relevant section of code.

private string ImagePath => AppDomain.CurrentDomain.BaseDirectory + "Pickups\\" + Name + ".png";
        
public int Id
{
    get => id;
    set
    {
        id = value;
        Image = new BitmapImage(new Uri(ImagePath));
                
        NotifyPropertyChanged("Id");
        NotifyPropertyChanged("Name");
    }
}

The relevant part of the exception is as follows:

No imaging component suitable to complete this operation was found.
at System.Windows.Media.Imaging.BitmapDecoder.SetupDecoderFromUriOrStream(Uri uri, Stream stream, BitmapCacheOption cacheOption, Guid& clsId, Boolean& isOriginalWritable, Stream& uriStream, UnmanagedMemoryStream& unmanagedMemoryStream, SafeFileHandle& safeFilehandle)
at System.Windows.Media.Imaging.BitmapDecoder.CreateFromUriOrStream(Uri baseUri, Uri uri, Stream stream, BitmapCreateOptions createOptions, BitmapCacheOption cacheOption, RequestCachePolicy uriCachePolicy, Boolean insertInDecoderCache)
at System.Windows.Media.Imaging.BitmapImage.FinalizeCreation()
at System.Windows.Media.Imaging.BitmapImage.EndInit()
at System.Windows.Media.Imaging.BitmapImage..ctor(Uri uriSource, RequestCachePolicy uriCachePolicy)
at System.Windows.Media.Imaging.BitmapImage..ctor(Uri uriSource)
at TaintedCain.Pickup.set_Id(Int32 value) in D:\Projects\RiderProjects\TaintedCain\TaintedCain\Pickup.cs:line 38
at TaintedCain.Pickup..ctor(Int32 id, Int32 amount) in D:\Projects\RiderProjects\TaintedCain\TaintedCain\Pickup.cs:line 69
at TaintedCain.ItemManager..ctor() in D:\Projects\RiderProjects\TaintedCain\TaintedCain\ItemManager.cs:line 61
at TaintedCain.MainWindow..cctor() in D:\Projects\RiderProjects\TaintedCain\TaintedCain\MainWindow.xaml.cs:line 24
 
 
The component cannot be found. (0x88982F50)

I don't really have a way to debug this any further since I don't get the error on my machine. The user has tried multiple release versions; the images aren't missing or corrupted.

c#
uri
bitmapimage
asked on Stack Overflow Apr 28, 2021 by Earlh21

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0