Skip to content

Support WinRT APIs in .NET 5 #35318

@AaronRobinsonMSFT

Description

@AaronRobinsonMSFT

We are moving to a new model for supporting WinRT APIs as part of .NET 5.0. This includes calling APIs (in either direction; CLR <==> WinRT), marshaling of data between the two type systems, and unification of types that are intended to be single instance (i.e. "projected types"). We will be removing the existing WinRT interop system from the .NET runtime (and any other associated components) as part of .NET 5.0.

We will rely on a new set of tools provided by the WinRT team in Windows that will generate C#-based WinRT interop assemblies. We are currently working closely with that team. The tools will be delivered for .NET 5.0.

There are several benefits to the new system:

  • Can be developed and improved separate from the .NET runtime.
  • Symmetrical with interop systems provided for other OSes, like iOS and Android.
  • Can take advantage of many other .NET features (AOT, C# features, IL linking).
  • Simplifies the .NET runtime codebase.

Goals

  • Allow the WinRT ecosystem to move independently of the .NET runtime with respect to WinRT projections.
  • Migration of existing applications and libraries to this new model should require minimal code changes. Creating a new project and recompilation is considered acceptable.
  • Provide a WinRT solution that is AOT and ILLinker friendly.
  • Permit the ability to remove built-in .NET Runtime support of WinRT.
  • Provide similar performance to what is available with .NET Core 3.1.

Non-Goals

  • Support existing WinMD-based managed WinRT assemblies.
  • Replace the MCG tool used by .NET Native.

.NET Runtime/SDK work

CsWinRT work

Breaking changes

Removal of built-in WinRT support. See #37672.

/cc @richlander @jeffschwMSFT @jkoritzinsky @elinor-fung

Metadata

Metadata

Labels

EpicGroups multiple user stories. Can be grouped under a theme.area-Interop-coreclrbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions