CommunityToolkit / Maui

The .NET MAUI Community Toolkit is a community-created library that contains .NET MAUI Extensions, Advanced UI/UX Controls, and Behaviors to help make your life as a .NET MAUI developer easier
https://learn.microsoft.com/dotnet/communitytoolkit/maui
MIT License
2.2k stars 375 forks source link

[BUG] Camera View - Zoom does not work when application is built in release mode #2109

Open LHunter91 opened 1 month ago

LHunter91 commented 1 month ago

Is there an existing issue for this?

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

When built in release mode there is no way to zoom the camera view - while all tried methods work perfectly in debug mode

Expected Behavior

Zoom to work in both release and debug

Steps To Reproduce

Run attached code base, set to release mode and deploy to an android device, press the zoom button to see nothing happens

How ever when deployed in debug mode it works

Link to public reproduction project repository

https://github.com/jfversluis/MauiCameraViewSample

Environment

- OS: Andorid
- .NET MAUI:

Anything else?

No response

soroushsarabi commented 1 month ago

I have same issue

AmenehShadlo commented 4 weeks ago

I have same issue, any solution?

nk-alex commented 3 weeks ago

Same issue here

AugPav commented 3 weeks ago

Same problem in release. We tested it in our own development, and added a DisplayAlert to the zoom in/out button to verify that the button worked. The display looks perfect but the zoom doesn't work.

LHunter91 commented 2 weeks ago

Issue still not fixed in Nuget Version 1.0.4 MCT.Maui.Camera

jaqsilva commented 2 weeks ago

im having the same problem. It seems to me that the MaxZoomFactor is always 1. Somehow i can zoom on the front camera where MaxZoomFactor is not set to 1 but on the rear camera its always 1.

Edit: i've realised that i can zoom in both cameras in debug. the problem is when i have the emulator camera set to "virtual" instead of "emulated" i cant zoom in debug. Now i can zoom in both camera in debug, but when i deploy to release i cant zoom in none of them.

"My Resolution": Not the optimal scenario but if you disable AoT compilation and code trimming for release you can zoom after the deploy.

bijington commented 2 weeks ago

@jaqsilva thank you for that update! It sounds like something is being trimmed out of your application when being built. We currently have IsTrimmable set to false in our projects because we aren't fully compliant with it - we hope to be when .NET 9 ships though. This makes me believe it is the AoT compilation that would be causing it as the code shouldn't be trimmed.