[BUG] Unable to load camera with Community Toolkit update 2.0.0
dharamhbtik opened this issue · 1 comments
dharamhbtik commented
Is there an existing issue for this?
- I have searched the existing issues
Did you read the "Reporting a bug" section on Contributing file?
- I have read the "Reporting a bug" section on Contributing file: https://github.com/CommunityToolkit/Maui/blob/main/CONTRIBUTING.md#reporting-a-bug
Current Behavior
We have migrated our app to .NET 9 from .NET 8 and we were using community toolkit camera for taking pictures. After updating the toolkit to latest version which was released on 18th December 2024, it started crashing the app .
It is throwing below error
[mono-rt] [ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: void AndroidX.Camera.Core.Preview.SetSurfaceProvider(AndroidX.Camera.Core.Preview/ISurfaceProvider)
[mono-rt] at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[<StartUseCase>d__14](<StartUseCase>d__14& stateMachine)
[mono-rt] at CommunityToolkit.Maui.Core.CameraManager.StartUseCase(CancellationToken token)
[mono-rt] at CommunityToolkit.Maui.Core.CameraManager.<>c__DisplayClass41_0.<<PlatformConnectCamera>b__0>d.MoveNext() in /_/src/CommunityToolkit.Maui.Camera/CameraManager.android.cs:line 164
[mono-rt] --- End of stack trace from previous location ---
[mono-rt] at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state)
[mono-rt] at Android.App.SyncContext.<>c__DisplayClass2_0.<Post>b__0() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.App/SyncContext.cs:line 36
[mono-rt] at Java.Lang.Thread.RunnableImplementor.Run() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Java.Lang/Thread.cs:line 37
[mono-rt] at Java.Lang.IRunnableInvoker.n_Run(IntPtr jnienv, IntPtr native__this) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/obj/Release/net9.0/android-35/mcw/Java.Lang.IRunnable.cs:line 59
[mono-rt] at Android.Runtime.JNINativeWrapper.Wrap_JniMarshal_PP_V(_JniMarshal_PP_V callback, IntPtr jnienv, IntPtr klazz) in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/JNINativeWrapper.g.cs:line 22
Expected Behavior
Camera should open with preview and user should be able to capture images.
Steps To Reproduce
- Download the samples provided in the community toolkit repo
- Update the toolkit camera version to latest version
- run the application and open the camera page
- It will crash
Link to public reproduction project repository
Environment
- .NET MAUI CommunityToolkit:10.0.0
- OS: Android 13
- .NET MAUI: 9.0
Anything else?
No response