Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] MediaPicker.CapturePhotoAsync not working (msix installed) #24098

Open
PauchardThomas opened this issue Aug 8, 2024 · 9 comments
Open
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@PauchardThomas
Copy link

Description

MediaPicker not working at all after installing app through .msix (Release mode) !

When launching the app (no admin rmode) :

  • CapturePhotoAsync not doing anything
  • PickPhotoAsync working great

When launching the app (admin mode) :

  • CapturePhotoAsync working great
  • PickPhotoAsync throw an exception
issue.mp4

Reproduction repo : https://github.com/PauchardThomas/MauiMediaPickerIssue

Also see the same issue on https://learn.microsoft.com/en-us/answers/questions/1661755/maui-mediapicker-default-capturephotoasync-windows but no solution has been found by Microsoft Team....

What can we do ? We canno't deploy our app on production !

Steps to Reproduce

  1. Generate Windows Release app.
  2. Install the app with .msix file
  3. Launch the app as without admin rights
  4. TakePhoto not working

Reproduction repo : https://github.com/PauchardThomas/MauiMediaPickerIssue

Link to public reproduction project repository

No response

Version with bug

8.0.80 SR8

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 10 (22H2)

Did you find any workaround?

No !

Relevant log output

No response

@PauchardThomas PauchardThomas added the t/bug Something isn't working label Aug 8, 2024
Copy link
Contributor

github-actions bot commented Aug 8, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@jfversluis jfversluis added platform/windows 🪟 area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info labels Aug 8, 2024
@MartyIX
Copy link
Contributor

MartyIX commented Aug 8, 2024

What can we do ?

Kind of hesitate to suggest it but IMHO it should be fairly easy for you to debug your issue more in detail yourself using MAUI's sandbox project:

MediaPicker implementation for Windows is here: https://github.com/dotnet/maui/blob/main/src/Essentials/src/MediaPicker/MediaPicker.uwp.cs AFAIK.

I would check your issue more in detail but I don't have access to my dev machine at the moment.

PS: The other idea is to check if this part https://github.com/dotnet/maui/blob/main/src/Templates/src/templates/maui-mobile/Platforms/Windows/Package.appxmanifest#L42-L44 is correct and if you don't need some additional capability (given that it works with an admin account and not with an ordinary one).

@Zhanglirong-Winnie Zhanglirong-Winnie added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Aug 9, 2024
@Zhanglirong-Winnie
Copy link

This issue has been verified using Visual Studio 17.11.0 Preview 7.0(8.0.80). Can repro on Windows platform.

@PauchardThomas
Copy link
Author

PauchardThomas commented Aug 9, 2024

I was able to reproduce the issue on the maui Essentials.Sample project.

  1. Launch the project on Release
  2. Go to Media Picker Page
  3. Click on Capture Photo
  4. Nothing happened

Details :

https://github.com/dotnet/maui/blob/main/src/Essentials/src/MediaPicker/MediaPicker.uwp.cs

line 126 :

var result = await WinLauncher.LaunchUriForResultsAsync(uri, options, set);`

=> result.Status value is LaunchUriStatus.Unknow then CaptureFileAsync method return null

@MartyIX
Copy link
Contributor

MartyIX commented Aug 9, 2024

(Permalink is:

var result = await WinLauncher.LaunchUriForResultsAsync(uri, options, set);
(for future reference))

What uri, options, and set are passed in?

@MartyIX
Copy link
Contributor

MartyIX commented Aug 9, 2024

Btw: I have found this workaround in a WinUI bug: microsoft/WindowsAppSDK#1034 (comment) and #13220 which implemented current code in MAUI.

There is also some proposal in WinAppSdk microsoft/WindowsAppSDK#4576 for cameras.

@PauchardThomas
Copy link
Author

PauchardThomas commented Aug 9, 2024

(Permalink is:

var result = await WinLauncher.LaunchUriForResultsAsync(uri, options, set);

(for future reference))
What uri, options, and set are passed in?

issue-essentials.mp4

I also launch my repro app (after installed msix) on a Windows 11 PC and it work on it ! Seems to be an OS issue (Windows 10 ?) to launch the Camera App....

My Windows 10 version :

  • (winver) : 22H2 (build 19045. 4651)
  • ((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId) 2009

@MartyIX
Copy link
Contributor

MartyIX commented Aug 9, 2024

I also launch my repro app (after installed msix) on a Windows 11 PC and it work on it ! Seems to be an OS issue (Windows 10 ?) to launch the Camera App....

Interesting find.

My Windows 10 version :

* (winver) : **22H2 (build 19045. 4651)**

* ((Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').ReleaseId) **2009**

Hm, I can see that that OS will be supported only for another year here: https://learn.microsoft.com/en-us/lifecycle/announcements/windows-10-22h2-end-of-support-update and that it is the most up to date version of Windows 10. Hmmm.

I don't have a Windows 10 machine to test. Perhaps, it makes sense to ask here https://github.com/microsoft/microsoft-ui-xaml/discussions or directly in microsoft/WindowsAppSDK#1034.

@PauchardThomas
Copy link
Author

PauchardThomas commented Aug 9, 2024

The only workaround that I found for now is to the implement the MediaCapture Class to create a camera view and create some buttons to take photo, retry and cancel...

For now i didn't found any workaround to open the Camera App.

Edit : A lib already exist : Camera.MAUI

@jsuarezruiz jsuarezruiz added this to the Backlog milestone Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-essentials Essentials: Device, Display, Connectivity, Secure Storage, Sensors, App Info platform/windows 🪟 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants