Open kazo0 opened 3 years ago
But, possibly we could adjust the project to generate multiple netstandard
packages? ala Uno.UI with Uno.UI.WebAssembly & Uno.UI.Skia
An other option could be to have runtime conditional xaml?: xaml_uri_or_using_namespace?is_platform(platform0[,platform1...])
There's already support for this using Cross-Runtime libraries.
For reference: https://stackoverflow.com/questions/70994056/uno-platform-cross-platform-library-if-conditional-for-wasm
Stack OverflowIn pre 4.0 Uno-Platform, I was able to use the #if __WASM__ compiler directive for WebAssembly specific code in a cross platform class library. This was very useful for creating WASM specific widg...
@kazo0 I think this can now be closed, as the docs were updated, right?
This may actually change with net8.0-browser
, we'll need to reevaluate at that time.
@jeromelaban Darsh is now doing https://github.com/unoplatform/Uno.Themes/issues/1298, what should we do for wasm:
and skia:
prefixes in the docs? Should we explicitly mention it works in cross-runtime libraries only? Plus, should we have a crossruntime:
prefix?
The problem gets worse because if someone now uses not_wasm
or not_skia
in non cross-runtime library, it is evaluated to true, which is very confusing. Maybe we should make the compilation fail unless the library is cross-runtime library and wasm
or skia
prefixes are used OR we just make wasm
==skia
==crossruntime
in non-cross runtime libraries, but still - doing not_skia
would the also mean not_wasm
, so the compiler error would make more sense to me. It could even mention something like "if you want to use skia
, wasm
, not_skia
and not_wasm
, you need to use cross-runtime library" with a link to the docs. @jeromelaban @Youssef1313
@MartinZikmund this scenario is particularly broken now that net8.0-browser
is not slated to be included in .NET. Failing the compilation is likely to be an important breaking change.
At this time, the easiest way to handle this particular scenario is to make custom user controls that switch using runtime conditions (by detecting wasm), or to use state triggers to switch values.
The more complex way is to use cross-runtime libraries.
Creating an issue on GitHub to track this issue
Current behavior
Using conditional XAML with the
wasm:
orskia:
prefix does not work when compiling inside of an Uno LibraryHow to reproduce it (as minimally and precisely as possible)
Workaround
Use a Cross-Runtime Library?
Environment
Nuget Package:
Nuget Package Version(s):
Affected platform(s):
IDE:
Relevant plugins: