Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

[Bug] [MauiCompat] Xamarin.CommunityToolkit.MauiCompat CameraView produces Android No view found for fragment CameraFragment error #1914

Open
@julianadormon

Description

@julianadormon

Thanks in advance!! I'm quite new to XAML so be kind :)

Description

My requirement is to add a CameraView to a .net Maui app which runs on Android and iOS. I understand that there is no CameraView in the Maui.Community.Toolkit but I was under the impression, which may be wrong, that I could run the Xamarin.Community.Tookit.MauiCompat packages which I'm trying to do in the code below.

Stack Trace

--- End of managed Java.Lang.IllegalArgumentException stack trace ---
java.lang.IllegalArgumentException: No view found for id 0x1 (unknown) for fragment CameraFragment{4e42a40} (ddc40138-4928-4ebc-bfd4-b5fb0b1cacdc id=0x1 tag=camera)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:513)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:261)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1840)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1758)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1701)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2849)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2784)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:262)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:478)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:246)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1455)
at android.app.Activity.performStart(Activity.java:8076)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3660)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2210)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

Link to Reproduction Sample

I posted my code to stack-overflow but if you need a repo, please let me know:
https://stackoverflow.com/questions/73889560/xamarin-communitytoolkit-mauicompat-cameraview-produces-android-no-view-found-fo

Steps to Reproduce

  1. Create a .net Maui Blazor app
  2. Install and use Xamarin.CommunityToolkit.MauiCompat in MauiProgram.cs
  3. Configure handlers
  4. Add CameraView to XAML and appropriate Event Callbacks as per this demo
    https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Views/CameraViewPage.xaml
    https://github.com/xamarin/XamarinCommunityToolkit/blob/main/samples/XCT.Sample/Pages/Views/CameraViewPage.xaml.cs
  5. Run degug to Android Emulator Pixel 5 (API 31)

Expected Behavior

Expect program to build and run

Actual Behavior

Program errors with Java error

Basic Information

  • Version with issue:
  • Last known good version: Xamarin.CommunityToolkit.MauiCompat 2.0.2 1013
  • IDE: Visual Studio Community 2022 for Mac Preview Version 17.4 Preview (17.4 build 1583)
  • Platform Target Frameworks: Android, iOS

Visual Studio Community 2022 for Mac Preview
Version 17.4 Preview (17.4 build 1583)
Installation UUID: 0b36004a-e5d9-4978-ae2a-2d2f56351cff

Runtime
.NET 6.0.5 (64-bit)
Architecture: Arm64

Roslyn (Language Service)
4.4.0-2.22419.1+ae5663806be933515723b2d5a85faf5d378f460d

NuGet
Version: 6.3.0.128

.NET SDK (Arm64)
SDK: /usr/local/share/dotnet/sdk/7.0.100-rc.1.22431.12/Sdks
SDK Versions:
7.0.100-rc.1.22431.12
6.0.401
6.0.400
6.0.400-preview.22330.6
MSBuild SDKs: /Applications/Visual Studio (Preview).app/Contents/MonoBundle/MSBuild/Current/bin/Sdks

.NET SDK (x64)
SDK Versions:
5.0.408
3.1.423
3.1.422
3.1.421

.NET Runtime (Arm64)
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
7.0.0-rc.1.22426.10
6.0.9
6.0.8
6.0.6

.NET Runtime (x64)
Runtime: /usr/local/share/dotnet/x64/dotnet
Runtime Versions:
5.0.17
3.1.29
3.1.28
3.1.27

Xamarin.Profiler
Version: 1.8.0.19
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Version: 11

Apple Developer Tools
Xcode 14.0.1 (21336)
Build 14A400

Xamarin.Mac
Version: 8.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:54-0400

Xamarin.iOS
Version: 15.12.0.2 (Visual Studio Community)
Hash: 87f98a75e
Branch: d17-3
Build date: 2022-07-25 20:18:55-0400

Xamarin Designer
Version: 17.4.0.124
Hash: ffbba0c031
Branch: remotes/origin/d17-4
Build date: 2022-09-15 15:36:42 UTC

Xamarin.Android
Version: 13.0.99.81 (Visual Studio Community)
Commit: xamarin-android/main/7c9c24b
Android SDK: /Users/macminim1/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
12.0 (API level 31)

SDK Command-line Tools Version: 7.0
SDK Platform Tools Version: 33.0.2
SDK Build Tools Version: 33.0.0

Build Information:
Mono: dffa5ab
Java.Interop: xamarin/java.interop/main@2c8b0a8f
SQLite: xamarin/sqlite@40e8743
Xamarin.Android Tools: xamarin/xamarin-android-tools/main@29f11f2

Microsoft Build of OpenJDK
Java SDK: /Library/Java/JavaVirtualMachines/microsoft-11.jdk
11.0.12
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Eclipse Temurin JDK
Java SDK: /Library/Java/JavaVirtualMachines/temurin-8.jdk
1.8.0.302
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 17.4.0.45
Hash: 8cac7ea
Branch: remotes/origin/HEAD~1
Build date: 2022-09-15 15:36:46 UTC

Android Device Manager
Version: 0.0.0.1196
Hash: b2faf27
Branch: main~1
Build date: 2022-09-15 15:36:46 UTC

Build Information
Release ID: 1704001583
Git revision: 70322329919c72a11d9795a3cb403fe4115a5878
Build date: 2022-09-15 15:34:40+00
Build branch: release-17.4
Build lane: release-17.4

Operating System
Mac OS X 12.5.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
Sat Jun 18 17:05:47 PDT 2022
root:xnu-8020.140.41~1/RELEASE_ARM64_T8101 arm64

Build Information
Release ID: 1704001583
Git revision: 70322329919c72a11d9795a3cb403fe4115a5878
Build date: 2022-09-15 15:34:40+00
Build branch: release-17.4
Build lane: release-17.4

Operating System
Mac OS X 12.5.0
Darwin 21.6.0 Darwin Kernel Version 21.6.0
Sat Jun 18 17:05:47 PDT 2022
root:xnu-8020.140.41~1/RELEASE_ARM64_T8101 arm64

  • Nuget Packages:
  <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.9" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
  <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.9">
    <PrivateAssets>all</PrivateAssets>
    <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
  </PackageReference>

  <PackageReference Include="SQLitePCLRaw.core" Version="2.1.2" />
      <PackageReference Include="SQLitePCLRaw.provider.sqlite3" Version="2.1.2" />
      <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.2" />
      <PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.2" />
  <PackageReference Include="Microsoft.Extensions.Identity.Core" Version="6.0.9" />
  <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.2" />
  <PackageReference Include="Radzen.Blazor" Version="4.1.0" />
  <PackageReference Include="Serilog.Sinks.Seq" Version="5.2.0" />
  <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
  <PackageReference Include="ZXing.Net.Maui" Version="0.1.0-preview.7" />
  <PackageReference Include="BlazorComponentBus" Version="2.1.0" />
  <PackageReference Include="Xamarin.CommunityToolkit.MauiCompat" Version="2.0.2-preview1013" />
  <PackageReference Include="Xamarin.CommunityToolkit.Markup.MauiCompat" Version="2.0.2-preview1013" />
</ItemGroup>
  • Affected Devices:

  • MAUI Version:
    Could not find it anywhere but I imagine it recent as this is a new install of Visual Studio Preview for Mac,

Workaround

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. Breaky break.maui-compat

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions