Skip to content

Add a read-only IInspectable vector - #5485

Merged
Kenny Kerr (kennykerr) merged 6 commits into
masterfrom
read-only-inspectable-vector
Nov 24, 2026
Merged

Kenny Kerr (kennykerr) merged 6 commits into
masterfrom
read-only-inspectable-vector

Conversation

@kennykerr

Copy link
Copy Markdown
Collaborator

Adds IVector<IInspectable>::from_read_only, backed by AgileReference, and uses it for Reactor string lists. Mutation methods return E_NOTIMPL.

Also fixes a core output-array ownership bug found by the native interop tests. The core fix is in a separate commit.

Related to #5469. Mutable collections and broader producer bounds remain separate work.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The changes affect cross-apartment behavior, reentrant iteration, final release, and output-array ownership, but the required Windows native interop and Reactor runtime checks could not be run.

No open issues 🎉

What changed in this PR

Adds a read-only IInspectable vector for Windows collection consumers and adopts it for Reactor
string lists. Agile-reference storage addresses this collection's apartment-handling needs without
expanding into mutable collections or broader producer bounds from #5469.

Changes:

  • Adds IVector<IInspectable>::from_read_only, with shared immutable storage and mutations returning
    E_NOTIMPL.
  • Fixes WinRT fill-array initialization so producers do not release incoming output-storage contents.
  • Adds Rust, C++, C#, and WinUI coverage for collection behavior, ownership, and apartment access.
File Description
crates/​tests/​libs/​reactor/​tests/​ui/​selection.rs Shares the selection helper with collection tests.
crates/​tests/​libs/​reactor/​tests/​ui/​main.rs Adds collection contract and live-consumer tests.
crates/​tests/​libs/​reactor/​src/​lib.rs Registers collection fixtures.
crates/​tests/​libs/​reactor/​src/​collections/​mod.rs Adds instrumented sources and native adaptation checks.
crates/​tests/​libs/​reactor/​src/​collections/​live.rs Exercises live controls with three collection implementations.
crates/​tests/​libs/​reactor/​readme.md Documents collection coverage and its limits.
crates/​tests/​libs/​reactor/​Cargo.toml Adds collection and boxing dependencies.
crates/​tests/​libs/​reactor/​build.rs Generates native bindings for collection fixtures.
crates/​tests/​libs/​collections/​tests/​stock_vector.rs Adds an output-storage ownership regression test.
crates/​tests/​libs/​collections/​tests/​read_only_vector.rs Tests reads, iteration, lifetime, identity, and apartment behavior.
crates/​tests/​libs/​collections/​Cargo.toml Enables COM and synchronization APIs for tests.
crates/​tests/​libs/​bindgen/​src/​ownership_tests.rs Checks zero-initialized fill-array outputs.
crates/​tests/​interop/​fixtures/​collections/​read_only.h Adds C++ ownership, failure, reentrancy, and concurrency checks.
crates/​tests/​interop/​fixtures/​collections/​component.rs Exposes the read-only vector through the test component.
crates/​tests/​interop/​fixtures/​collections/​client.rs Checks Rust consumption of the component's read-only vector.
crates/​tests/​interop/​fixtures/​collections/​client.cs Checks C# consumption, including null elements.
crates/​tests/​interop/​fixtures/​collections/​client.cpp Runs the C++ read-only collection checks.
crates/​tests/​interop/​fixtures/​collections/​api.rdl Declares the component's read-only collection method.
crates/​libs/​reactor/​src/​native/​winui/​dependency.rs Uses read-only vectors for string-list properties.
crates/​libs/​core/​src/​imp/​array_slice.rs Initializes raw fill-array storage before borrowing it.
crates/​libs/​collections/​src/​read_only_vector.rs Implements agile-reference-backed vectors, views, and iterators.
crates/​libs/​collections/​src/​lib.rs Enables the new implementation under std.
crates/​libs/​collections/​readme.md Documents construction, mutation rejection, and COM responsibilities.

Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

COM ownership, cross-apartment behavior, and shared output-array initialization changes require human confirmation of Windows-native interop, final-release, and diagnostic WinUI tests that could not run in this review environment.

No open issues 🎉

Review effort: Balanced

@kennykerr
Kenny Kerr (kennykerr) merged commit af18e40 into master Nov 24, 2026
51 checks passed
@kennykerr
Kenny Kerr (kennykerr) deleted the read-only-inspectable-vector branch November 24, 2026 19:10
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.

2 participants