Skip to content

Separate exclusive-interface visibility from IDIC policy - #2576

Open
Sergio Pedri (Sergio0694) wants to merge 5 commits into
staging/3.0from
user/sergiopedri/exclusive-interface-control
Open

Sergio Pedri (Sergio0694) wants to merge 5 commits into
staging/3.0from
user/sergiopedri/exclusive-interface-control

Conversation

@Sergio0694

Copy link
Copy Markdown
Member

Summary

Keep public-exclusive interface visibility independent from dynamic interface casting, and add dedicated IDIC include/exclude filters. Preserve the producer's exact selection across reference projection packages using WindowsRuntimeReferenceAssemblyMetadataAttribute key/value entries without changing WindowsRuntimeReferenceAssemblyAttribute.

Motivation

Application-time projection generation currently infers IDIC requirements from public reference interfaces, losing the distinction between exposing an interface and enabling native dynamic casts. Projection authors need to preserve their public API while opting into IDIC explicitly and selecting only the interfaces they need.

IDIC now requires CsWinRTDynamicallyInterfaceCastableExclusiveTo=true; includes narrow the eligible set and exclusions always win. Missing selection metadata does not imply opt-in, so preview projection packages that require IDIC must be regenerated. Projected types remain globally unique, with duplicate definitions reported as errors.

Changes

The changes are organized into three commits:

  • Runtime/tooling and unit coverage (fc7369dc): wire independent selection through nuget\, src\WinRT.Generator.Tasks\, the reference and implementation projection generators, and src\WinRT.Projection.Writer\, including incremental inputs and debug-repro save/replay. Add reference-only WinRT key/value metadata and shared contract constants, preserve required ABI/CCW support, and align IDIC inherited members with the actual projected inheritance surface. Extend src\Tests\ProjectionWriterTest\ with policy, metadata, output-shape, diagnostics, and producer/consumer regressions.
  • Packaged smoke coverage (8c049a9b): extend src\Tests\SmokeTests\ with isolated producer/package/consumer profiles, native allowed/denied casts, ordinary interfaces, managed CCW round-trips, and filter-only rebuilds on CoreCLR and Native AOT. Preserve the standalone IFrameworkElementProtected7 case with its owner in the SDK projection.
  • Documentation (989fcb3b): update docs\usage.md, docs\aot-trimming.md, docs\diagnostics\cswinrt3004.md, and nuget\readme.md with filter precedence, reference-only metadata, preview migration, and diagnostics.

Validation

  • All 156 projection-writer tests passed.
  • Release generator/task builds and the isolated stripped runtime reference build passed.
  • All eight CoreCLR smoke profiles and the Native AOT public-only, both-enabled, and excluded runtime cases passed using a uniquely versioned, isolated x64 validation SDK with locally built framework-dependent generator tools.
  • The metadata stays in reference projections; generated implementation projections, forwarders, and interop assemblies do not receive it.

Require explicit IDIC opt-in and support narrowing include/exclude filters. Preserve exact producer intent through reference-only WinRT key/value metadata, validate duplicate projected types, and align IDIC members with projected inheritance. Cover the generator pipeline, metadata, and ABI behavior with unit regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exercise producer boolean combinations, reference metadata, native dynamic casts, managed CCWs, and filter-only incremental rebuilds through isolated projection packages. Preserve standalone SDK-owner coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Explain independent switches, prefix filtering, reference-only key/value metadata, preview package regeneration, and duplicate type diagnostics. Document the shared CSWINRT3004 warning and trimming behavior.

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

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
CI build 157910863 failed in all x64/x86 configurations because WinUI and UWP XAML intentionally both project FullXamlMetadataProviderAttribute. These metadata-only attribute classes emit no WinRT type-map keys, so they must not participate in runtime-type duplicate validation. Keep genuine projected runtime types and exact IDIC requirements checked, and cover the failure with producer/consumer regressions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CsWinRT 3.0 tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant