Xamarin.forms: [Enhancement] Support .NET 5 on Xamarin.Forms 5.x

Created on 14 Sep 2020  Â·  6Comments  Â·  Source: xamarin/Xamarin.Forms

Summary

As Xamarin.Forms 5.0 is the latest major version until .NET MAUI, it would be very useful to target .NET 5.

.NET 5 is still in Release Candidate, but it is planned to target it in Xamarin.Forms when it's released? Or we will have to wait for .NET MAUI and .NET 6?

API Changes

Target new net5.0* framework.

Intended Use Case

Use libs that targets .NET 5 with Xamarin.Forms.

proposal-open enhancement âž•

Most helpful comment

Xamarin.Forms can run on .NET 5, but I imagine we actually want Android and iOS to be supported platform targets. Almost nothing we need to enable running on a new .NET exists within this repo. .NET 5 doesn't have the stuff we want. It's in .NET 6.

@davidortinau Just curious, but could you elaborate on the stuff that is necessary to support net5 as a platform target on iOS and Android? Mono is still a supported runtime for .NET5, specifically targeted at these platforms (and WebAssembly). Only the BCL has been replaced by the .NET core one. WebAssembly Blazor is more than happy to run .NET 5 code on Mono inside a web browser.

I figured it would be possible to just update mono and have .NET5 for free, just as we got netstandard2.1 more or less for free with Xamarin due to the mono update.

It also effectively blocks an upgrade for Mobile Blazor Bindings to .NET5 and the new Blazor. These will be forced to support the 3.2 version of Blazor for an entire year while .NET 5 Blazor with many improvements releases shortly.

All 6 comments

@YZahringer I hear you. This is unlikely to happen, and that's a good thing. By targeting .NET 6 we can:

  • continue shipping Xamarin.Forms at the current cadence of every 6 weeks
  • continue shipping Android and iOS SDK updates in a timely fashion (imagine shipping iOS 14 for 2 different versions of .NET, double the work, yikes!)
  • allow the .NET/Mono engineering teams the time and focus to enable AOT, linker, crypto, and other very necessary things for mobile platforms
  • allow the Xamarin teams to focus on the vNext work that promises to have huge impact, specifically in the architecture of the renderers (yes, existing apps will continue to work)

Xamarin.Forms can run on .NET 5, but I imagine we actually want Android and iOS to be supported platform targets. Almost nothing we need to enable running on a new .NET exists within this repo. .NET 5 doesn't have the stuff we want. It's in .NET 6.

@davidortinau thank you for the details. Yes, the future with .NET 6 is amazing 😃

But in the meantime, we have to keep making incredible apps with Xamarin.Forms 😉

For example, we use EF Core 3.1 with SQLite in several apps. With EF Core 5.0, the .NET Standard 2.0 is no longer supported. This one requires .NET Standard 2.1, which is currently not supported by UWP. This should be fixed by new WinRT APIs support in .NET 5. This will also be supported by UWP Xamarin.Forms apps?

.NET 5 also provides performances improvements. This could also improve the performance of Xamarin apps?

C# 9 also requires .NET 5?

Xamarin.Forms can run on .NET 5, but I imagine we actually want Android and iOS to be supported platform targets. Almost nothing we need to enable running on a new .NET exists within this repo. .NET 5 doesn't have the stuff we want. It's in .NET 6.

@davidortinau Just curious, but could you elaborate on the stuff that is necessary to support net5 as a platform target on iOS and Android? Mono is still a supported runtime for .NET5, specifically targeted at these platforms (and WebAssembly). Only the BCL has been replaced by the .NET core one. WebAssembly Blazor is more than happy to run .NET 5 code on Mono inside a web browser.

I figured it would be possible to just update mono and have .NET5 for free, just as we got netstandard2.1 more or less for free with Xamarin due to the mono update.

It also effectively blocks an upgrade for Mobile Blazor Bindings to .NET5 and the new Blazor. These will be forced to support the 3.2 version of Blazor for an entire year while .NET 5 Blazor with many improvements releases shortly.

Found a nice list of issues for iOS/macOS because of the changes to the runtime for .NET 5: https://github.com/xamarin/xamarin-macios/issues/8901.

Some more issues (and some enhancements) here:
https://github.com/xamarin/xamarin-macios/milestone/35

For mono on android:
https://github.com/xamarin/xamarin-android/milestone/21

Blazor Mobile Bindings is near the top of my things to try. If it won't work with NET5 it looks like it has died before it even got started and so isn't even worth considering.

.NET5 support required for Blazor Mobile Bindings to consume net5.0 based libraries.

if "Xamarin.Forms can run on .NET 5", please do consider for the future of Blazor Mobile Bindings to be even considered for trying out.

getting familiar with Blazor Mobile Bindings, would help us explore MAUI as well which is planned to support Blazor model as well.

Was this page helpful?
0 / 5 - 0 ratings