Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in support for WinRT is removed from .NET 5.0 #18875

Closed
AaronRobinsonMSFT opened this issue Jun 9, 2020 · 4 comments
Closed

Built-in support for WinRT is removed from .NET 5.0 #18875

AaronRobinsonMSFT opened this issue Jun 9, 2020 · 4 comments
Assignees
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 5 Work items for the .NET 5 release doc-idea Indicates issues that are suggestions for new topics [org][type][category]

Comments

@AaronRobinsonMSFT
Copy link
Member

AaronRobinsonMSFT commented Jun 9, 2020

Built-in support for WinRT is removed from .NET 5.0

Built-in support for consumption of WinRT APIs in .NET Core is being removed. This possibility has been announced in dotnet/runtime#35318.

The removal was done in dotnet/runtime#36715.

Version introduced

.NET 5.0

Old behavior

Consumption of WinMDs by CoreCLR was possible. This permitted activation and consumption of WinRT types.

New behavior

Direct consumption of WinMDs is no longer possible by CoreCLR.

Examples of failures that may now occur:

Attempting to reference a no longer supported WinRT related assembly:

System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Activation of a WinRT class will result in the following:

Unhandled exception. System.PlatformNotSupportedException: Operation is not supported on this platform. (0x80131539)

Reason for change

  • WinRT 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.

Recommended action

Remove references to the Microsoft.Windows.SDK.Contracts package and replace them with references to the Microsoft.Windows.SDK.NET package.

Additionally, the recommendation is to use the C#/WinRT tool chain to generate or customize WinRT APIs and types in .NET 5.0 and beyond.

Category

Interop

Affected APIs

System.Runtime.InteropServices.WindowsRuntime

System.Runtime.WindowsRuntime


Issue metadata

  • Issue type: breaking-change
@AaronRobinsonMSFT AaronRobinsonMSFT added the breaking-change Indicates a .NET Core breaking change label Jun 9, 2020
@dotnet-bot dotnet-bot added the ⌚ Not Triaged Not triaged label Jun 9, 2020
@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Built-in support for WinRT is remove from .NET 5.0 Built-in support for WinRT is removed from .NET 5.0 Jun 9, 2020
@gewarren gewarren self-assigned this Jun 9, 2020
@gewarren gewarren added doc-idea Indicates issues that are suggestions for new topics [org][type][category] Pri0 Indicates issues or PRs that are critical priority and removed ⌚ Not Triaged Not triaged labels Jun 9, 2020
@danmoseley
Copy link
Member

Would it be helpful to include the typical error(s) that code could produce that is encountering this break? Eg., what was in the two issues you looked at this morning. That might make it much easier to find this page once you've hit the problem.

Also, do we have sufficient help for someone making the jump to the new toolchain?

@gewarren gewarren removed the Pri0 Indicates issues or PRs that are critical priority label Jun 9, 2020
@AaronRobinsonMSFT
Copy link
Member Author

AaronRobinsonMSFT commented Jun 9, 2020

@gewarren This change was made in preview 6, not preview 5. I mean .NET 5.0 Preview 6. I submit that your team may have different preview numbers.

@AaronRobinsonMSFT
Copy link
Member Author

Also, do we have sufficient help for someone making the jump to the new toolchain?

Yep. We have had someone ask a question already: dotnet/runtime#35318 (comment).

@gewarren
Copy link
Contributor

gewarren commented Jun 9, 2020

@gewarren This change was made in preview 6, not preview 5. I mean .NET 5.0 Preview 6. I submit that your team may have different preview numbers.

Ok thanks. I'll delete my original comment just so there's no confusion. (We don't use different preview numbers.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Indicates a .NET Core breaking change 🏁 Release: .NET 5 Work items for the .NET 5 release doc-idea Indicates issues that are suggestions for new topics [org][type][category]
Projects
None yet
Development

No branches or pull requests

4 participants