Repository navigation
Description
Current behavior 🐛
Most InputInjector members are marked [Uno.NotImplemented] for the Android, iOS/tvOS and WebAssembly flavors, even though injection is implemented and works on those Skia heads. The member list on master (InputInjector.cs):
| Member | Flavors listed as not implemented |
|---|---|
TryCreate() / TryCreate(object) (L73, L91) |
__ANDROID__, __IOS__, __NETSTD_REFERENCE__ |
InjectMouseInput (L496) |
__ANDROID__, __IOS__, __WASM__, __NETSTD_REFERENCE__ |
InjectKeyboardInput (L329, added by #23970) |
__ANDROID__, __IOS__, __TVOS__, IS_UNIT_TESTS, __WASM__, __NETSTD_REFERENCE__ |
Initialize/UninitializeTouchInjection, InjectTouchInput, Initialize/UninitializePenInjection, InjectPenInput (L133-L259) |
__ANDROID__, __IOS__, __TVOS__, __WASM__, __NETSTD_REFERENCE__ |
Because Uno.WinRT is built once per flavor, the UnoNotImplementedAnalyzer (UNO0001) evaluates these tokens against the consumer's flavor. An app head or library built for browserwasm, android or ios that calls these members gets a "not implemented" warning for an API that works there.
Expected behavior 🎯
The attributes should list only flavors where the API really is unimplemented (__NETSTD_REFERENCE__), or be dropped. No UNO0001 warning on Skia Android, iOS/tvOS or WebAssembly heads. The IS_UNIT_TESTS token on InjectKeyboardInput is not a flavor token the analyzer knows and has no effect.
For comparison, WinUI implements InputInjector fully; this is a metadata problem in Uno only.
How to reproduce it 🔬
Confirmed by code inspection on master (0599dad), not at runtime.
- Create (or take) a Skia head targeting
net10.0-browserwasm,net10.0-androidornet10.0-ios. - Add the following to any code file in that head:
var injector = InputInjector.TryCreate();
injector?.InjectMouseInput(new[] { new InjectedInputMouseInfo() });
injector?.InjectKeyboardInput(new[] { new InjectedInputKeyboardInfo() });- Build. Expected diagnostics: UNO0001 on
TryCreate,InjectMouseInputandInjectKeyboardInput(the analyzer mapsBROWSERWASMto__WASM__,ANDROIDto__ANDROID__,IOSto__IOS__, seeUnoNotImplementedAnalyzer.GetConsumerFlavorsandIsPerFlavorAssemblyforUno.WinRT).
Why the API is implemented on those heads (source-backed):
InputInjector.cshas no platform suffix and no#if, so it compiles into everyUno.WinRTflavor.Uno.UIis a single Skia build withHAS_INPUT_INJECTORdefined (Uno.CrossTargetting.targets), andInputManagerregisters itself as the injection target (InputManager.csL32-L33) on every head.
Not verified: running the injection itself on a Skia Android/iOS/WASM device. The warnings follow from the attribute lists and the analyzer logic.
Workaround 🛠️
Suppress UNO0001 at the call site (#pragma warning disable UNO0001).
Works on UWP/WinUI
Yes (no such warning; the API is implemented).
Affected platforms 📱💻🖥️
WebAssembly (Skia), Android (Skia), iOS/tvOS (Skia)
Uno.Sdk version (and other relevant versions) 📦
master @ 0599dad (7.0, net10.0/net11.0)
IDE version 🧑💻
N/A (build diagnostic)
Anything else we need to know? 💬
The lists predate 7.0, when these flavors meant the removed native renderers; #23970 copied the pattern for InjectKeyboardInput. The fix is to trim the attributes to __NETSTD_REFERENCE__ (and remove IS_UNIT_TESTS).
Activity