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

TFM mappings for WebAssembly and MonoUE #2159

Closed
wants to merge 1 commit into from

Conversation

mhutch
Copy link

@mhutch mhutch commented Apr 12, 2018

Added TFMs for WebAssembly and Mono for Unreal Engine.

Like other Mono-based frameworks, these are compatible with netstandard 2.0.

@rohit21agrawal
Copy link
Contributor

@joelverhagen you know this area, could you take a peek please?

@@ -68,6 +68,8 @@ public static class FrameworkIdentifiers
public const string XamarinXboxOne = "Xamarin.XboxOne";
public const string UAP = "UAP";
public const string Tizen = "Tizen";
public const string WebAssembly = "WebAssembly";
Copy link
Member

@joelverhagen joelverhagen Apr 13, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this WebAssembly TFM really appropriate? What really defines the compatibility level between WebAssembly and .NET Standard 2.0? Said another way, is there an official compatibility matrix between WebAssembly and .NET Standard assemblies? Truth be told, I am pretty ignorant about .NET + WebAssembly (and WebAssembly in general). This is the closest thing I could find: https://github.com/xamarin/WebSharp.

At first glance, this seems overly generic and perhaps could be renamed to the tool that is interopping between .NET Standard assemblies and WebAssembly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear I am not totally pushing back on the name, just trying to understand the full picture.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a new framework based on the Mono runtime that runs in the browser and has access to browser APIs. See also https://github.com/mono/mono/tree/master/sdks/wasm. This is the framework used by Blazor.

netstandard compat level is the same as the Xamarin frameworks, i.e. unversioned and assumed to be latest.

cc @migueldeicaza @terrajobst

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be more appropriate to name it MonoWebAssembly or MonoWasm

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The WebAssembly target is compatible with .NET Standard 2, but it is a superset of that API, as it is provides many capabilities not found on .NET Standard 2, it is based on the various mobile profiles used by Xamarin.

I do not think that we need to brand this as a Mono web assembly, it is not an implementation specific profile.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A WebAssembly TFM would make sense if there were a stable subset of APIs specific to WebAssembly, a WebAssemblyStandard 1.0, such as this:

https://github.com/mono/mono/blob/master/sdks/wasm/bindings.cs#L21

But are we already in such a state to know about this ? Currently, I'm blocked in many occasions by the fact that making nuget packages is not possible, and also because I cannot reference a package that provides this Runtime class.

Similarly, should there be a WebAssemblyApp and MonoWebAssemblyApp ?

Even if there is only MonoWebAssembly or NetCoreWebAssembly to begin with, re-targetting to WebAssembly when it will make sense is now very easy, and could be dealt with the runtime nuget feature.

Copy link

@terrajobst terrajobst Oct 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @jeromelaban that an abstract WebAssembly TFM would be like .NET Standard. Which also explains why I don't think we should have another one -- we started .NET Standard specifically to unify all existing portability mechanisms (Silverlight, PCL, contracts) into a single thing that was simpler & more viable (i.e. has enough APIs). Moving forward, we don't want specific TFM mappings anymore; rather an asset should only be considered compatible if it matches the project's TFM or the corresponding .NET Standard version.

Personally, I think we need a TFM that designates a particular implementation of web assembly, rather than the concept. And MonoWebAssembly sounds like a fine plan to me.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while MonoWebAssembly would be fine in practice, i want to note that as a library author the reasons i need a tfm here are not mono-specific. i need to make multitargeted builds which do not access certain features of .net standard (threading, filesystem) and instead use less efficient implementations or provide fewer features. these are limitations of wasm conceptually, not limitations of mono’s wasm implementation.

this doesn’t matter much since a hypothetical future with <TargetFrameworks>monowasm;corewasm<TargetFrameworks> would not be very costly

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i need to make multitargeted builds which do not access certain features of .net standard (threading, filesystem) and instead use less efficient implementations or provide fewer features
these are limitations of wasm conceptually, not limitations of mono’s wasm implementation

I believe these are more the limitations of the browser then of WebAssembly itself. For example, I believe you could write a different WebAssembly host (perhaps something like wasmjit) that doesn't have these restrictions.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i suppose it's a matter of what 'syscalls' (or DOM bindings) are exposed to the WASM host

@@ -904,6 +904,8 @@ public void Compatibility_ProjectCannotInstallGenerationLibraries(string framewo
[InlineData("xamarinxboxthreesixty")]
[InlineData("xamarinwatchos")]
[InlineData("xamarinxboxone")]
[InlineData("wasm")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have some tests asserting that wasm and monoue does not support .NET Standard 2.1? Essentially a test verifying the max .NET Standard version is exactly what is expected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do this for any of the other frameworks, and I suspect them to support 2.1 pretty quickly.

I'd love to delegate this information to the framework instead of centralizing it all in one place.

Copy link
Member

@joelverhagen joelverhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⌚️

@rohit21agrawal
Copy link
Contributor

@mhutch if you still want this PR to go in, can you please address the feedback?

@mhutch
Copy link
Author

mhutch commented Apr 23, 2018

@rohit21agrawal re. the TFM name, see Miguel's response.

Re. the request for tests, none of the existing TFMs have the suggested tests, and I don't think wasm is any different than them.

@danroth27
Copy link

@davidfowl

@danroth27
Copy link

One concern with having a generic WebAssembly TFM is how would you reason about targeting WebAssembly in browsers vs running in other environments that support WebAssembly but don't have the same limitations? For example, what if you are running on WebAssembly in Node or in an Electron app?

@terrajobst
Copy link

Two questions:

  1. Which API surface/platform does wasm represent?
  2. What's the mapping between .NET Standard and wasm?

@marek-safar
Copy link

@terrajobst

  1. The API surface will probably closest to the latest netcore
  2. What do you mean by mapping? It'll be netstandard 2 compatible if that's what you are asking

@jeromelaban
Copy link

@marek-safar it will be close to netstandard2.0, but it will have web assembly specific apis (https://github.com/mono/mono/blob/8de852ea9e611c3e841d33ad26dde8bd034e4325/sdks/wasm/bindings.cs) so it should be "mono5.x-wasm1.0" ?

@marek-safar
Copy link

That's fine, we'll just expose this API as a different package. It does not affect how netstandard is defined. Actually, the exact opposite is needed. We need to control how the netstandard implementation works on WASM target. There was discussion above where I suggested having more fine-grained control by defining Mono specific TFM so the netstandard packages could have in theory multiple WASM backends support, similar to coreclr/mono support but it looks like folks are in favour of single TFM.

@jeromelaban
Copy link

Sure, it's in a different package, but what's the TFM for this one? If wasm replicates the platform vs runtime ambiguity for Xamarin.ios and MonoAndroid, this is still compatibility issue regarding the Platform/BCL/Runtime version matrix.

wasm1.0 is a platform, and if the definition stays this way, it will implicitly mean wasm1.0 running on mono runtime because of internal calls dependencies. What if .NET core happens to support wasm as well ?

@gulbanana
Copy link

any progress on choosing a tfm name? as a library developer, i cannot support blazor until cross-targeting is available. the runtime environment is too different (no threads etc)

@kzu
Copy link
Contributor

kzu commented Aug 17, 2018

Would love to see this merged. I don't think there are outstanding issues, are there?

@rohit21agrawal
Copy link
Contributor

the test failures on this PR are an issue for now, can @mhutch also rebase and push so we can validate against the latest dev branch?

@mhutch
Copy link
Author

mhutch commented Aug 29, 2018

@rohit21agrawal rebased and pushed

@mhutch
Copy link
Author

mhutch commented Sep 6, 2018

@rohit21agrawal looks like it failed due to the VSTS outage. Can we re-run it?

@mhutch
Copy link
Author

mhutch commented Sep 20, 2018

It doesn't look like the failing tests are related to these changes. What can I do to move this along?

@rohit21agrawal
Copy link
Contributor

@mhutch
Copy link
Author

mhutch commented Sep 20, 2018

Sorry, didn't see those among all the random failures. Fixed!

@rohit21agrawal
Copy link
Contributor

@mhutch CompatibilityListProvider tests are still failing on linux/mac/windows . You can ignore the functional test failures related to UwpBlankApp and Apex Test Failures

@mhutch
Copy link
Author

mhutch commented Sep 24, 2018

ok, i think i fixed it.

@mhutch
Copy link
Author

mhutch commented Oct 3, 2018

I have some packages that need to use this TFM :/

@joelverhagen joelverhagen dismissed their stale review October 4, 2018 21:33

This is a higher level decision than I can make.

@jainaashish
Copy link
Contributor

@mhutch Without understanding the background and proper scenario for this PR and analyzing alternate means to achieve it, we won't be able to proceed. So I'd suggest to set some time with @rrelyea to discuss and proceed with the PR.

@jainaashish
Copy link
Contributor

There is no point in keeping this PR open at this time, until this has been discussed and finalized. So I'm closing this PR for now.

@jainaashish jainaashish closed this Dec 6, 2018
@jeromelaban
Copy link

@jainaashish is there a opened issue for discussing this ?

@jainaashish
Copy link
Contributor

Not that I see any.. @mhutch can you open a workitem with all the details?

@gulbanana
Copy link

The lack of a tfm other than netstandard is still blocking me from porting libraries to Blazor.

@weitzhandler
Copy link

Ping.
This issue is blocking authors of .NET Standard frameworks to have wasm-specific ports. Can you please dedicate a TFM?
Could this issue be reopened?

@jainaashish have you had the chance to discuss this with @rrelyea?

@jainaashish
Copy link
Contributor

@nkolev92 @anangaur

@nkolev92
Copy link
Member

nkolev92 commented Jun 4, 2019

@weitzhandler
These are decisions that are going to be made with other TFM stakeholders (not unilaterally by NuGet)
Please continue the discussion on the following issue: NuGet/Home#8186

@weitzhandler
Copy link

@nkolev92 I wish there was WebAssembly even as a general TFM temporarily, or any other immediate solution. Right now, NuGet and wasm don't work well together, can't build platform wasm projects with NuGet.
This is like a blocking issue.

@nkolev92
Copy link
Member

nkolev92 commented Jun 5, 2019

@weitzhandler

TFM changes are never temporary though.

If/when a new tfm is added, the scenario should be well understood and in conformance to where we think the eco-system needs to move, not as a workaround.

Regardless, expect updates on NuGet/Home#8186.

@weitzhandler
Copy link

Then a general wasm should be added permanently, then when we're ready, all the various dialects.

@nkolev92
Copy link
Member

nkolev92 commented Jun 5, 2019

I think the argument on the other issue is that we should not keep adding different dialects through additional frameworks.
Having too many frameworks was not a great experience in the past and we're trying to avoid it here.

The folks on that thread(Immo, Rich) have better context and know more about this topic than I ever will so I will defer to them. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.