I have the following code
cs
private static async Task<BitmapSource> LoadBitmapSourceUsingWIC(Folders folder, string path)
{
StorageFile file = await GetStorageFileAsync(folder, path);
BitmapSource bmSource;
unsafe
{
IWICImagingFactory* wicImagingFactory = CoreGraphics.WicImagingFactory.GetPtr();
IWICBitmapDecoder* bmDecoder;
IWICBitmapFrameDecode* bmFrame = null;
IntPtr fileNameIntPtr = Marshal.StringToHGlobalAnsi(file.Path);
HRESULT hr = wicImagingFactory->CreateDecoderFromFilename(
(ushort*)fileNameIntPtr,
null,
GENERIC_READ,
WICDecodeOptions.WICDecodeMetadataCacheOnDemand,
&bmDecoder);
But it's throwing a FileNotFoundException. The file (StorageFile) is valid.