Closed lhak closed 4 months ago
@manodasanW Is there a reason why NetFxToWinRtStreamAdapter
is said to must not inherit directly from IRandomAccessStream
?
Just wanted to add the stack trace of the crash:
App.exe!WinRT_Runtime_WinRT_ComWrappersSupport__CreateCCWForObjectForABI() Line 170
App.exe!WinRT_Runtime_WinRT_ComWrappersSupport__CreateCCWForObjectForMarshaling() Line 1187
App.exe!WinRT_Runtime_WinRT_MarshalInspectable_1<System___Canon>__CreateMarshaler2() Line 1789
App.exe!WinRT_Runtime_WinRT_MarshalInterface_1<System___Canon>__CreateMarshaler2() Line 1619
App.exe!WinRT_Runtime_WinRT_MarshalInterface_1<System___Canon>__FromManaged() Line 1647
App.exe!Microsoft_Windows_SDK_NET_ABI_Windows_Storage_Streams_IInputStream__Do_Abi_ReadAsync_0()
Microsoft.ui.xaml.dll!DirectUI::BitmapSource::SetSourceShared(ABI::Windows::Storage::Streams::IRandomAccessStream * pStreamSource) Line 172
Microsoft.ui.xaml.dll!DirectUI::BitmapSource::SetSourceImpl(ABI::Windows::Storage::Streams::IRandomAccessStream * pStreamSource) Line 225
Microsoft.ui.xaml.dll!DirectUI::BitmapSourceGenerated::SetSource(ABI::Windows::Storage::Streams::IRandomAccessStream * pStreamSource) Line 66
Microsoft.ui.xaml.dll!DirectUI::BitmapImage::SetSource(ABI::Windows::Storage::Streams::IRandomAccessStream * pStreamSource) Line 64
The obj parameter in CreateCCWForObjectForABI() is of type Microsoft_Windows_SDK_NET_System_Threading_Tasks_TaskToAsyncOperationWithProgressAdapter_2
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:
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