Skip to content

Uno Specific Preprocessor Directives don't work #191

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

Closed
michael-hawker opened this issue Jul 8, 2022 · 7 comments · Fixed by #208
Closed

Uno Specific Preprocessor Directives don't work #191

michael-hawker opened this issue Jul 8, 2022 · 7 comments · Fixed by #208
Assignees
Labels
bug 🐛 Something isn't working build 🔥 Uno Issues related to Uno Platform WASM Bugs related to working with WASM/Codespaces

Comments

@michael-hawker
Copy link
Member

michael-hawker commented Jul 8, 2022

Related to #174 maybe as we should update Uno version first.

Effects Experiment: #101

According to Uno docs here around platform specific C# code. We should be able to use the following values:

Platform Symbol
UWP NETFX_CORE
Android __ANDROID__
iOS __IOS__
WebAssembly HAS_UNO_WASM
macOS __MACOS__
Skia HAS_UNO_SKIA

I know we've been able to use a general HAS_UNO one (which is not listed in the doc?) and we define our own WINAPPSDK one. I also know the NETFX_CORE one works.

However trying to use __WASM__ or HAS_UNO_WASM is not working.

This makes the logic needed to guard against the Uno NotImplemented error in the CI and having the code actually work in WASM for SizerBase not work properly.

We need to understand what's going on here so we can properly guard code against specific platforms (if needed).

See Uno file here for reference as well.

@michael-hawker michael-hawker added bug 🐛 Something isn't working Uno Issues related to Uno Platform WASM Bugs related to working with WASM/Codespaces build 🔥 labels Jul 8, 2022
@michael-hawker michael-hawker added this to the Initial Release milestone Jul 8, 2022
@Arlodotexe
Copy link
Member

I've never used HAS_UNO_WASM before, but __WASM__ has always worked as expected for me.

@michael-hawker
Copy link
Member Author

@Arlodotexe I can confirm that the place I'm using it in SizerBase is not working as the mouse cursor is being disabled unless I comment out the #if so something is missing in the Labs configuration:

#if NETFX_CORE || __WASM__ || __MACOS__ || __SKIA__
CoreCursorType cursor = GetCursor((FrameworkElement)sender);
Window.Current.CoreWindow.PointerCursor = _cursors[cursor];
#endif

This is only working on UWP currently as written due to the NETFX_CORE. I added this after we got CI exceptions because the other platforms through the Uno not implemented warning/error.

@Arlodotexe
Copy link
Member

Arlodotexe commented Jul 8, 2022

Perhaps something just isn't implemented fully on Uno's side for WASM?

This might help => https://platform.uno/docs/articles/features/cursors.html

@michael-hawker
Copy link
Member Author

Perhaps something just isn't implemented fully on Uno's side for WASM?

This might help => https://platform.uno/docs/articles/features/cursors.html

It is working, I think their document is out-of-date. I have validated already that the __WASM__ pre-processor directive is not-working within our source. It is the root of the issue. The Cursor code is fine when unguarded, but triggers issues in the build on the other platforms, so it needs to be guarded.

@Arlodotexe
Copy link
Member

@michael-hawker We can always add it back using our Labs.Wasm.props file.

@michael-hawker
Copy link
Member Author

michael-hawker commented Jul 12, 2022

@michael-hawker We can always add it back using our Labs.Wasm.props file.

The Labs.Wasm.props is for WASM heads, but this is in the multi-targeted library, so it's not that simple. (That was the first thing I thought of initially, but that only works for cases where we need to do something specific in our sample app vs. a component.)

@Arlodotexe
Copy link
Member

I've also confirmed that these aren't always working as intended.

I've got a solution that will fix these for us and make them work as expected, even in multitargeted libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working build 🔥 Uno Issues related to Uno Platform WASM Bugs related to working with WASM/Codespaces
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants