Closed scottteague closed 1 year ago
I have made a commit which has the device logs since they are so large that they could not be added to the issue via the web page.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
If anyone is ever looking at this in the future I tried doing this in a way that seems "Lower Level" in my real project by Doing the following. It also failed (without any exception I could see) so maybe there could be something even lower level causing the issue?
I added:
<provider android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider
to my AndroidManifest.xml then added a file called file_paths.xml in my resources with the following code:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="local" path="." />
</paths>
Then I added the following code into my actual code:
public string TestTakePhotoADifferentWay(string filename)
{
var context = Android.App.Application.Context;
var activity = Platform.CurrentActivity as MainActivity;
using (var intent = new Intent(MediaStore.ActionImageCapture))
{
var file = new Java.IO.File(filename);
var uri = FileProvider.GetUriForFile(context, context.ApplicationContext.PackageName + ".fileprovider", file);
intent.PutExtra(MediaStore.ExtraOutput, uri);
activity.StartActivityForResult(intent, 0);
return file.Path;
}
}
I know that the StartActivityForResult() doesn't get waited on but even not trying to do anything with the photo the app still crashes.
Another strange behavior is that this seems not to happen for a while after a reboot.
Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Not repro on Android platform with sample project. https://github.com/scottteague/photo1
Hi @scottteague. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version.
You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository.
This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.
Description
Normally upon calling MediaPicker.CapturePhotoAsync the camera pops up and allows the user to take a photo. However, on a Kyocera C6930 with the default camera settings the app crashes about 7/10 times right after taking a picture. There usually seems to be a pause or stutter when the crash happens. The linked solution works on all tested devices except for the Kyocera C6930.
A strange behavior worth noting is that the frequency of crashing goes down if I set the resolution to be the lowest amount and the "Auto HDR"/"Auto Night Detection" settings to off. I don't know if there is a different method I could use to try taking photos which might get us around this issue.
I am including a very simple app which just takes a picture and displays it. It should work fine on most things, but crashes almost every time a picture is taken on a Kyocera C6930. The device log was too long to submit. I can include certain lines if you tell me what to look for.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/scottteague/photo1
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
6.0.486/6.0.400 (All the way back to Xamarin)
Did you find any workaround?
Not a complete workaround: When the photo resolution is set to medium and the "Auto HDR"/"Auto Night Detection" settings are turned off it crashes slightly less often.
I'd love to try a different workaround if you know of one.
Relevant log output