Skip to content

CameraPreview control not working on WinUI 3 #4577

Open
@LeoCarriere

Description

@LeoCarriere

Describe the bug

The Problem :

CameraPreview from CommunityToolkit.WinUI.UI.Controls ( which I managed to make it work perfectly fine under UWP on the same computer ) is unable to show frames from the camera.

Output from Debug :

When the StartAsync() method is initiated I get multiple instance of the following error ( see screenshots section ) :
avcore\mf\frameserver\fsutils\fsutils.cpp(362)\MFSENSORGROUP.dll!5F640094: (caller: 5F61190D) ReturnHr(1) tid(49e4) 80070490 Element not found.

avcore\mf\frameserver\fsutils\fsutils.cpp(639)\MFSENSORGROUP.dll!5F640610: (caller: 5F613F90) ReturnHr(4) tid(49e4) 80070002 The system cannot find the file specified.

Regression

No response

Reproducible in sample app?

  • This bug can be reproduced in the sample app.

Steps to reproduce

You can directly try yourself by using the public repositories i created :
- WinUI version (not working) : https://github.com/LeoCarriere/CameraPreviewTestWinUI
- UWP version (working): https://github.com/LeoCarriere/CameraPreviewTestUWP

The steps I followed:
- create a blank app from WinUI template using Visual Studio Community 2022 (17.2.3)
- Install the toolkit using the following article : https://devblogs.microsoft.com/ifdef-windows/windows-community-toolkit-for-project-reunion-0-5/ with of curse all Microsoft.Toolkit.Uwp.* renamed to be CommunityToolkit.WinUI.* .
- Add a Button and a CameraPreview
- Add a function to start the camera preview on the click of the button

Expected behavior

Get a frame like the uwp control (see the screenshot section)

Screenshots

WinUI version of the app output (not working) :

error

UWP version of the app output (working):

UWP

Windows Build Number

  • Windows 10 1809 (Build 17763)
  • Windows 10 1903 (Build 18362)
  • Windows 10 1909 (Build 18363)
  • Windows 10 2004 (Build 19041)
  • Windows 10 20H2 (Build 19042)
  • Windows 10 21H1 (Build 19043)
  • Windows 11 21H2 (Build 22000)
  • Other (specify)

Other Windows Build number

No response

App minimum and target SDK version

  • Windows 10, version 1809 (Build 17763)
  • Windows 10, version 1903 (Build 18362)
  • Windows 10, version 1909 (Build 18363)
  • Windows 10, version 2004 (Build 19041)
  • Other (specify)

Other SDK version

No response

Visual Studio Version

No response

Visual Studio Build Number

No response

Device form factor

No response

Nuget packages

  • CommunityToolkit.WinUI (7.1.2)
  • CommunityToolkit.WinUI.UI.Controls (7.1.2)
  • Microsoft.Windows.SDK.BuildTools (10.0.22000.197)
  • Microsoft.WindowsAppSDK (1.1.0)

Additional context

Attempt to fix it :

After some research I came to the understanding that MFSENSORGROUP.dll is from the Microsoft Media Foundation or Media Feature Pack.

So I updated Windows and check for integrety of the system to see if it was a problem with my own computer / version of windows, This attempt did not fix the problem.
cmd

I also did a quick search on my C: drive ( were the OS is installed ) and found many instance of the mfsensorgroup.dll so maybe the CommunityToolkit use a wrong path to find the dll.
DLLsearch

Looking forward for any help, thank you ! 😊

Help us help you

Yes, I'd like to be assigned to work on this item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    WinUI 💠Related to WinUI 3 Version or when paired with External can mean requires fix in WinUI 2/3.external ⤴️Requires an update to an external dependency or due to code outside the Toolkit.

    Type

    No type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions