CsWinRT
CsWinRT copied to clipboard
Loading images using .net file streams does not work when AOT is enabled
Describe the bug
Calling BitmapImage.SetSourceAsync() with a .net file stream using stream.AsRandomAccessStream() leads to WinRT originate error - 0x80004002 : 'Specified cast is not valid.'
To Reproduce
Code similar to the one below:
using (FileStream stream = File.OpenRead(path))
{
bitmapImage = new BitmapImage();
await bitmapImage.SetSourceAsync(stream.AsRandomAccessStream());
}
works correctly when AOT is disabled but not when it is enabled
Expected behavior
.net file streams should work when AOT is enabled
Version Info
appsdk 1.6 experimental 1, CsWinRT 2.1.0-prerelease.240602.1
Additional context