Open ErisApps opened 10 months ago
We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.
Description
Due to the behavior not being documented in XML docs in regards of what happens when the user cancels picking/taking a picture or video, I started doing some digging through the source code
My initial use case is a Xamarin.Android app (running on .NET 7 for the time being) that has NRT enabled. At first, I thought that MediaPicker methods would result in an exception due to the shared class having
#nullable enable
at the top, but the methods themselves havingTask<FileResult>
as return type opposed toTask<FileResult?>
, letting the tooling in the IDE also indicate that null-checks are not needed.And... that guess was right... but seemingly not across all platforms. Tizen, iOS (and possibly MacOS) do indeed throw an exception (most likely TaskCancelledException), however... Android and UWP do just return
null
instead.Steps to Reproduce
Link to public reproduction project repository
I'll provide one in the upcoming days and will edit this section.
Version with bug
8.0.3
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android, Windows, macOS, Other (Tizen, Linux, etc. not supported by Microsoft directly)
Affected platform versions
Not applicable, it's an issue with the API implementation.
Did you find any workaround?
Both catching the exception and null-checking seems to do the trick in the cross-platform code, but I'd rather see a singular consistent approach.
Relevant log output
No response