-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
EpicGroups multiple user stories. Can be grouped under a theme.Groups 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.Issue or PR that represents a breaking API or functional change over a prerelease.
Milestone
Description
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
- Creation and management of COM wrappers.
- Support
ICustomQueryInterface
. - Provide a mechanism to determine if
ComWrappers
are being called from legacy APIs. - Ensure
IWeakReference
continues to interact with the .NET types:WeakReference
andWeakReference<T>
. See WeakReference and WeakReference<T> should continue to support IWeakReference #35745. - Support an
ICastable
-esque solution.
- Support
- C# function pointers to achieve performance goals.
- This work was already in flight with the C# function pointers proposal.
- Expose
NativeCallableAttribute
UnmanagedCallersOnlyAttribute
.
CsWinRT work
- Consume the new
ComWrappers
API. - Help generate C# source for interop code.
- Support correct managed object wrapper lifetime management. ObjectReference<T> needs to support the Dispose pattern for correct CCW lifetime microsoft/CsWinRT#37
- Support default implemented interfaces. Provide method for projections to add "default-implemented" interfaces for CCWs microsoft/CsWinRT#49
- Marshaling of arrays of interfaces. Marshalling Arrays of Interfaces to ABI selects the incorrect marshaler microsoft/CsWinRT#61
- Support
IRestrictedErrorInfo
. Add support for IRestrictedErrorInfo microsoft/CsWinRT#76 - Support
ICustomPropertyProvider
. Provide ICustomPropertyProvider interface by default. microsoft/CsWinRT#102
Breaking changes
Removal of built-in WinRT support. See #37672.
jeffschwMSFT, strangeman375, charlesroddie, danielchalmers, iam3yal and 17 moredanielchalmers, MichalStrehovsky, saint4eva, drearyrainDeng, lindexi and 3 morejkoritzinsky, danmoseley, strangeman375, stevenbrix, hoyosjs and 5 morestevenbrix, saint4eva and dzmitry-lahodapaulomorgado, Nirmal4G and saint4eva
Metadata
Metadata
Assignees
Labels
EpicGroups multiple user stories. Can be grouped under a theme.Groups 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.Issue or PR that represents a breaking API or functional change over a prerelease.