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: The WMC1510 warning message unexpectedly appears in the control template pulled by generic.xaml #1932

Open
Gaoyifei1011 opened this issue Feb 23, 2025 · 9 comments

Comments

@Gaoyifei1011
Copy link
Contributor

Description

The WMC1510 warning message unexpectedly appears in the control template pulled by generic.xaml

--------------------------------------

WMC1510 警告信息意外出现在 generic.xaml 拉取的控件模板中

Steps To Reproduce

When the DefaultTeachingTipStyle (TeachingTip) control template is pulled from the generic.xaml control template, additional WMC1510 information related to AOT publishing appears when the application is compiled

--------------------------------------

generic.xaml 控件模板中拉取 DefaultTeachingTipStyle(TeachingTip)控件模板时,应用编译时会出现以外的 WMC1510 信息,该信息与 AOT 发布有关

Expected Behavior

The WMC1510 information should not appear in the pulled TeachingTip control template

--------------------------------------

WMC1510 信息不应该出现在拉取的 TeachingTip 控件模板中

Version Info

CsWinRT 2.2.0
Windows App SDK 1.7-preview1
Visual Studio 17.13
.net 9.0.2

Additional Context

Image

Image

@dongle-the-gadget
Copy link
Contributor

Well it is correct here, using Binding in such a manner causes the application to fail on startup unless annotated with GeneratedBindableCustomProperty. This issue happened to the Windows Community Toolkit as well (CommunityToolkit/Windows#615).

@manodasanW
Copy link
Member

Yes, this is a new warning we added in the xaml compiler in WinAppSDK 1.7 for Binding scenarios when publishing for AOT to ensure that any Binding use is validated to make sure it to AOT safe (either statically via X:DataType and GeneratedBindableCustomProperty or manually by the developer and suppressed as AOT safe).

@Gaoyifei1011
Copy link
Contributor Author

Yes, this is a new warning we added in the xaml compiler in WinAppSDK 1.7 for scenarios when publishing for AOT to ensure that any use is validated to make sure it to AOT safe (either statically via and or manually by the developer and suppressed as AOT safe).Binding``Binding``X:DataType``GeneratedBindableCustomProperty

However, this control template comes from WinUI internal TeachingTip, pull the control template when the control template is only fine tuning the style of the control template, so there is no corresponding source code for the control template. I would like to ask you how I can suppress this message or modify the appearance of this warning?

@dongle-the-gadget
Copy link
Contributor

NoWarn works, but it will still fail as the binding is not safe. It works for WinUI since it is C++.

@Gaoyifei1011
Copy link
Contributor Author

NoWarn works, but it will still fail as the binding is not safe. It works for WinUI since it is C++.

Yes, this is a new warning we added in the xaml compiler in WinAppSDK 1.7 for Binding scenarios when publishing for AOT to ensure that any Binding use is validated to make sure it to AOT safe (either statically via X:DataType and GeneratedBindableCustomProperty or manually by the developer and suppressed as AOT safe).

Image

Yes, this is a new warning we added in the xaml compiler in WinAppSDK 1.7 for Binding scenarios when publishing for AOT to ensure that any Binding use is validated to make sure it to AOT safe (either statically via X:DataType and GeneratedBindableCustomProperty or manually by the developer and suppressed as AOT safe).

Forgot to say, in the error warning prompt said can use x:SupressXamlTrimWarnings="True" to suppress warnings, but I did not find this property in XAML intelligent perception

@manodasanW
Copy link
Member

Yes, you can use x:SupressXamlTrimWarnings="True" on the Binding and it should suppress it. Does that work? The XAML IntelliSense is not up to date on new directives that were added.

<TextBox x:Uid="TextInput1" Text="{Binding InputText, Mode=TwoWay, x:SuppressXamlTrimWarnings=True}" />

@Gaoyifei1011
Copy link
Contributor Author

Yes, you can use x:SupressXamlTrimWarnings="True" on the Binding and it should suppress it. Does that work? The XAML IntelliSense is not up to date on new directives that were added.

<TextBox x:Uid="TextInput1" Text="{Binding InputText, Mode=TwoWay, x:SuppressXamlTrimWarnings=True}" />

Image

Image

I tried to add it and encountered an error during compilation

@manodasanW
Copy link
Member

I am curious, if you look at the output window after a build rather than the error list, what is the error there?

@Gaoyifei1011
Copy link
Contributor Author

I am curious, if you look at the output window after a build rather than the error list, what is the error there?

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants