Skip to content

fix(metadata): IIDs of generics over classes with a generic default interface - #45

Merged
triniwiz merged 1 commit into
mainfrom
fix/generic-default-interface-iid
Nov 6, 2026
Merged

triniwiz merged 1 commit into
mainfrom
fix/generic-default-interface-iid

Conversation

@triniwiz

@triniwiz triniwiz commented Nov 6, 2026

Copy link
Copy Markdown
Member

On napi, NSWinRT.toPromise(DeviceInformation.FindAllAsync(...)) rejected with "interface property 'Completed' construction failed".

DeviceInformationCollection's default interface is itself generic (IVectorView<DeviceInformation>). ClassDeclaration::default_interface() only returns plain interfaces, so wire_signature_for_name had no signature for the class. IAsyncOperation<DeviceInformationCollection> then got a zero IID, and the QueryInterface for Completed failed.

WinRT signs a class as rc(Name;<default interface signature>), where a generic default interface contributes its full pinterface(...) signature. The class arm now does that through default_interface_full_name(). This applies to every class whose default interface is a generic instance; many *Collection classes are like this.

The metadata locator (which only the tests use) also unwrapped default_interface(). It now handles these classes with SetRuntimeClassParameterizedDefault, so a test can compare our IID with RoGetParameterizedTypeInstanceIID.

Testing

  • New metadata test: IAsyncOperation<DeviceInformationCollection> matches the OS.
  • toPromise(DeviceInformation.FindAllAsync('', ['System.Devices.HardwareIds'], DeviceInformationKind.Device)) resolves on napi (256 devices here); on main it rejects.
  • windows-napi npm test: 442/442. cargo test -p runtime --lib: same failures as main.

…nterface

A class whose default interface is itself generic, such as
DeviceInformationCollection (IVectorView<DeviceInformation>), had no
wire signature: ClassDeclaration::default_interface() only returns plain
interfaces, so IAsyncOperation<DeviceInformationCollection> got a zero
IID. The QueryInterface for it failed, and on napi
toPromise(DeviceInformation.FindAllAsync(...)) rejected with "interface
property 'Completed' construction failed". The class signature now
embeds the default interface's own pinterface(...) signature, as WinRT
specifies; a test checks the result against
RoGetParameterizedTypeInstanceIID.

The metadata locator, which only the tests use, handles such classes with
SetRuntimeClassParameterizedDefault instead of unwrapping.
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6e3f9746-dfb6-4777-b649-be36b9857b76

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@triniwiz
triniwiz merged commit 3b97f14 into main Nov 6, 2026
3 checks passed
@triniwiz
triniwiz deleted the fix/generic-default-interface-iid branch November 6, 2026 10:26
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.

1 participant