SuaveIO / suave

Suave is a simple web development F# library providing a lightweight web server and a set of combinators to manipulate route flow and task composition.
https://suave.io
Other
1.32k stars 198 forks source link

Suave 2.6.0 should support .net standard 2.0 #748

Closed jwosty closed 1 year ago

jwosty commented 3 years ago

Suave 2.5.x supported .net standard 2.0; Suave 2.6.x appears to have dropped support and upgrade to .net standard 2.1. This means that you can't use it anymore from .net framework or mono (and therefore Xamarin.Mac/Xamarin.iOS) and have to be stuck on Suave 2.5.x. I recommend that .net standard 2.0 support should be reinstated, if possible, for maximum compatibility.

teo-tsirpanis commented 3 years ago

IMHO .NET Standard 2.0 support should not be reintroduced. .NET Standard 2.1 does support Mono and Xamarin (just newer versions of them).

By targeting .NET Standard 2.1, Suave can (or might in the future) take advantage of newer high-performance APIs like Span or ValueTask. It's not the only library of its kind to exclude .NET Standard 2.0 (ASP.NET Core and Saturn came to my mind).

What is more, multitargeting will complicate testing should framework-specific code gets introduced, and double the package's size (Suave 2.6 weighs 568 KB while 2.5.6 weighs 1.06 MB).

jwosty commented 3 years ago

IMHO .NET Standard 2.0 support should not be reintroduced. .NET Standard 2.1 does support Mono and Xamarin (just newer versions of them).

I didn't realize that, thank you.

jwosty commented 3 years ago

For what it's worth, Microsoft's best practice recommendation is:

DO start with including a netstandard2.0 target. Most general-purpose libraries should not need APIs outside of .NET Standard 2.0. .NET Standard 2.0 is supported by all modern platforms and is the recommended way to support multiple platforms with one target.

I'm pretty sure .Net standard 2.0 supports Span and ValueTask, does it not? (albeit via dependencies). The advantage of supporting .Net Standard 2.0 is that it means you'd automatically support every major modern framework without any additional effort, and you still get the modern performance improvements.

I also never argued for multitargetting (only doing it in that PR I made, which is tackling two issues at once. Totally fair to criticize that.) Suave could set its one target to be netstandard2.0 and it would work just about everywhere.

It's possible, though, that this advice from MS is out of date, and that everything supports .Net standard 2.1 now -- in which case, we should bug MS to update their documentation. :) (According to this table, the only frameworks that seem to not support .net standard 2.1 would be the .Net Framework, UWP, and Unity)