Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upBitmapImage.SetSource is inconsistent between platforms #2377
Comments
There are two issues here:
For the second part, interestingly, uno/src/Uno.UI/UI/Xaml/Media/Imaging/BitmapSource.cs Lines 58 to 76 in 8dcc6f2 This should be an easy fix. |
@TopperDEL Do you need help completing the related PR? |
I just do not find the time, currently, to finish it. I would have to digg into the Unit-Tests for this. Would love to do it - but to be realistic I won't be able to finish it currently. Sorry for this! |
No worries, just wanted to make sure we weren't doing parallel efforts. Will check at some point if team can pick up on your PR. Thanks for all the work so far! |
Giving this converter that converts
bytes[]
to aBitmapImage()
The WINDOWS_UWP part and the part for other platforms is symmetric. However, when trying in, for instance, Android, this code produces the following exception:
As a workaround, the converter should be written as:
Please, notice that the #else part no longer encloses the stream in a
using
block, so the stream isn't disposed.I don't know what are the implications of this, but I would like to point out that the stream should be disposed eventually. We need to ensure that the resources are freed properly.
I would like to put into consideration that this converter raises the concert of SetSource not behaving the same between platforms, not only in the abstractions used, but also regarding the life cycle of the underlying stream.
I personally think this should be improved.