Skip to content

Fix CCW discovery for generated bindable property values - #2529

Open
Tom McDonald (tommcdon) wants to merge 1 commit into
microsoft:masterfrom
tommcdon:dev/tommcdon/fix-bindable-property-ccw-discovery
Open

Fix CCW discovery for generated bindable property values#2529
Tom McDonald (tommcdon) wants to merge 1 commit into
microsoft:masterfrom
tommcdon:dev/tommcdon/fix-bindable-property-ccw-discovery

Conversation

@tommcdon

Copy link
Copy Markdown
Member

Description

Fixes #2458.

GeneratedBindableCustomProperty generates accessors that return bindable
property values through object, but those generated accessors cannot be
analyzed by the same source-generator pass. For getter-only collection
properties, the concrete return type was therefore omitted from
WinRTGlobalVtableLookup.g.cs unless another authored or XAML-generated
expression happened to expose it across the WinRT ABI.

This caused UWP XAML bindings such as
ItemsSource="{Binding DisplayItems}" to return an
ObservableCollection<string> without registering its IVector<string>
CCW projection. Applications had to add an unrelated property to the page
code-behind or explicitly use GeneratedWinRTExposedExternalType to root
the collection.

Changes

  • Propagate the existing generated-bindable-property discovery flag through
    property initializers, expression-bodied properties, and block-bodied
    getter returns.
  • Add source-generator regressions for all three property forms.
  • Verify non-bindable properties do not trigger additional lookup generation.
  • Verify the generated lookup includes the correct WinRT projections.

Validation

Ensure property values exposed through GeneratedBindableCustomProperty contribute their concrete types to the generated CCW lookup table.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@tommcdon

Copy link
Copy Markdown
Member Author

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

Successfully merging this pull request may close these issues.

Bug: Binding issue

1 participant