curiosity-ai / h5

🚀 The next generation C# to JavaScript compiler
https://github.com/curiosity-ai/h5
Apache License 2.0
210 stars 30 forks source link

Target framework and language version mismatch #96

Open YImhof opened 2 months ago

YImhof commented 2 months ago

H5 documentation says "H5 projects are based on .Net Standard 2.1". And for that framework, as defined by MS, default language version is C# 8.0 (see Language versioning)

But for real, the H5 SDK enforces usage of .Net Standard 2.0, as any change of the targeted framework in the properties through VS IDE is immediately rolled-back. And even more, the SDK sticks to language version C# 7.2 (see comments in file Sdk.targets) instead of default C# 7.3, which is also the language version of .Net Framework 4. And adding a <LangVersion>7.3<LangVersion> tag in the project has no effect.

I am trying to migrate some projects, currently based on Bridge.Net, to H5. And that seems not so straightforward due to this language version mismatch. As a showstopper example I encountered, Bridge.Net allowed usage of the generic type constraint "Enum" which became available in C# 7.3. So, as H5 is a fork of Bridge.Net, are you sure that C# 7.3 is not the real language version?

At least, I think documentation should mention the real targeted framework and the non standard language version, as depending on the used language features, migration from Bridge.Net might be compromised.