You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you add the [GeneratedBindableCustomProperty] the generator creates all the necessary code to make that class bindable when using AOT compilation.
I have a sample class that contains an obsolete property:
[WinRT.GeneratedBindableCustomProperty]publicclassBlogPostViewModel{[Obsolete("Do not use this property")]publicintBlogId=>Random.Shared.Next();}
The CsWinRT created code produces a warning (in the generated WinRTCustomBindableProperties.g.cs):
Warning CS0618: 'BlogPostViewModel.BlogId' is obsolete: 'Do not use this property'
Rationale
I think this warning is not helpful and should go away.
Currently I can include all other properties in the propertyNames property of the attribute to exclude the one obsolete property. This makes the warning go away, but requires me to keep a list of all properties (minus the obsolete one).
Important Notes
No response
Open Questions
I could imagine one of these 3 approaches:
suppress CS0618 for the generated code
add an "excludedPropertiesNames" option to the attribute and the generator to exclude individual properties
add an "exclude obsolete properties" option to the attribute and the generator
The text was updated successfully, but these errors were encountered:
Given we already have an opt-in approach for specific properties in addition to all, what it sounds like to me is we also just need an opt-out approach for specific properties and that would satisfy this.
Summary
When you add the
[GeneratedBindableCustomProperty]
the generator creates all the necessary code to make that class bindable when using AOT compilation.I have a sample class that contains an obsolete property:
The CsWinRT created code produces a warning (in the generated WinRTCustomBindableProperties.g.cs):
Rationale
I think this warning is not helpful and should go away.
Currently I can include all other properties in the
propertyNames
property of the attribute to exclude the one obsolete property. This makes the warning go away, but requires me to keep a list of all properties (minus the obsolete one).Important Notes
No response
Open Questions
I could imagine one of these 3 approaches:
The text was updated successfully, but these errors were encountered: