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

Bug: Make TargetType support abstract classes #10228

Closed
mfkl opened this issue Dec 11, 2024 · 1 comment
Closed

Bug: Make TargetType support abstract classes #10228

mfkl opened this issue Dec 11, 2024 · 1 comment
Labels
bug Something isn't working closed-External Described behavior is not an issue with Windows App SDK. MAUI-request 🏝️ MAUI-request ???

Comments

@mfkl
Copy link

mfkl commented Dec 11, 2024

Describe the bug

Hi,

While trying to add support for MAUI WinUI in LibVLCSharp (videolan/libvlcsharp#370), I've ran into what I believe is a regression. Indeed this behavior is supported in other XAML/UI flavors so I believe it should also work in WinUI MAUI.

Given this style:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vlc="using:LibVLCSharp.Platforms.Windows">

    <Style TargetType="vlc:VideoViewBase">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="vlc:VideoViewBase">
                    <SwapChainPanel x:Name="SwapChainPanel" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

And this base class:

[TemplatePart(Name = PartSwapChainPanelName, Type = typeof(SwapChainPanel))]
public abstract class VideoViewBase : Control, IVideoView
{
/// stuff
}

This works fine in UWP, WinUI and Uno. But in WinUI for MAUI, I get the following error logs and stack trace:

Exception thrown at 0x00007FFE1316B699 (KernelBase.dll) in LibVLCSharp.MAUI.Sample.exe: WinRT originate error - 0x800F1000 : 'Cannot apply a Style with TargetType 'LibVLCSharp.Platforms.Windows.VideoViewBase' to an object of type 'Microsoft.UI.Xaml.Controls.Control'.'.
Microsoft.ui.xaml.dll!00007FFD09D843D2: 800F1000 - E_NER_INVALID_OPERATION
Exception thrown: 'System.Runtime.InteropServices.COMException' in WinRT.Runtime.dll
Exception thrown at 0x00007FFE1316B699 (KernelBase.dll) in LibVLCSharp.MAUI.Sample.exe: WinRT originate error - 0x800F1000 : 'No installed components were detected.

stack:

 	KernelBase.dll!00007ff95768b699()	Unknown
 	Microsoft.UI.Xaml.Controls.dll!00007ff8c616f5bf()	Unknown
 	Microsoft.UI.Xaml.Controls.dll!00007ff8c5d6d0b3()	Unknown
 	Microsoft.UI.Xaml.Controls.dll!00007ff8c5d82e9e()	Unknown
 	Microsoft.UI.Xaml.Controls.dll!00007ff8c5dc42c1()	Unknown
 	Microsoft.UI.Xaml.Controls.dll!00007ff8c5dd89a8()	Unknown
 	[Managed to Native Transition]	
>	Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.IFrameworkElementOverridesMethods.MeasureOverride(WinRT.IObjectReference _obj, Windows.Foundation.Size availableSize) Line 30	C#
 	Microsoft.WinUI.dll!Microsoft.UI.Xaml.FrameworkElement.MeasureOverride(Windows.Foundation.Size availableSize) Line 673	C#
 	Microsoft.WinUI.dll!Microsoft.UI.Xaml.FrameworkElement.Microsoft.UI.Xaml.IFrameworkElementOverrides.MeasureOverride(Windows.Foundation.Size availableSize) Line 678	C#
 	Microsoft.WinUI.dll!ABI.Microsoft.UI.Xaml.IFrameworkElementOverrides.Do_Abi_MeasureOverride_0(nint thisPtr, Windows.Foundation.Size availableSize, Windows.Foundation.Size* result) Line 33	C#

This looks like the same issue as CommunityToolkit/Windows#273.

I can reproduce the error 90% of the time when running the sample app.

Steps to reproduce the bug

  1. Clone Maui winui videolan/libvlcsharp#370
  2. Run the sample without videolan/libvlcsharp@267bf18
  3. Observe native exception on start

Expected behavior

Support abstract classes in Style TargetType in MAUI WinUI. Like in regular WinUI/UWP.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.6.3: 1.6.241114003

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

@mfkl mfkl added the bug Something isn't working label Dec 11, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Dec 11, 2024
@karkarl
Copy link
Contributor

karkarl commented Dec 12, 2024

This seems to be an issue with maui. Please re-file the bug with their repo:
https://github.com/dotnet/maui

@karkarl karkarl closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot removed the needs-triage Issue needs to be triaged by the area owners label Dec 12, 2024
@karkarl karkarl added closed-External Described behavior is not an issue with Windows App SDK. MAUI-request 🏝️ MAUI-request ??? labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closed-External Described behavior is not an issue with Windows App SDK. MAUI-request 🏝️ MAUI-request ???
Projects
None yet
Development

No branches or pull requests

2 participants