microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.36k stars 678 forks source link

Regression: .net nuget packaged controls not presentable when referencing from C++ project #9477

Open gyz0072004 opened 7 months ago

gyz0072004 commented 7 months ago

Describe the bug

This is a regression beginning from version 1.4.5: 1.4.240211001 upwards. Version 1.4.4 backwards doesn't have such issue.

When I create a C# Class Library project, referencing some components provided by other nuget packages (like CommunityToolkit.winui.ui.controls), then reference the C# library from C++ project according to Walkthrough—Create a C# component with WinUI 3 controls, and consume it from a C++/WinRT app that uses the Windows App SDK, the components from the nuget package.

Steps to reproduce the bug

Sample xaml in C# class library project (with nuget reference: CommunityToolkit.WinUI.UI.Controls):

<?xml version="1.0" encoding="utf-8"?>
<UserControl
    x:Class="Grid2.GridWrapper"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Grid2"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
    mc:Ignorable="d">

    <StackPanel Width="500" Height="500">
        <controls:RadialGauge x:Name="RadialGauge"
                              Width="280"
                              IsEnabled="True"
                              IsInteractive="True"
                              MaxAngle="150"
                              Maximum="240"
                              MinAngle="-150"
                              Minimum="0"
                              NeedleLength="60"
                              NeedleWidth="4"
                              ScalePadding="0"
                              ScaleTickWidth="0"
                              ScaleWidth="12"
                              StepSize="30"
                              TickLength="6"
                              TickSpacing="15"
                              TickWidth="2"
                              ValueStringFormat="N0"
                              Value="120" />
    </StackPanel>
</UserControl>

Then Create a C++ project to reference such user control

Expected behavior

The control provided by the nuget package should present with no issue.

Screenshots

No response

NuGet package version

Windows App SDK 1.5.1: 1.5.240311000

Packaging type

Packaged (MSIX), Unpackaged

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

No response

github-actions[bot] commented 7 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.