diff --git a/src/Uno.UI/LinkerDefinition.Wasm.xml b/src/Uno.UI/LinkerDefinition.Wasm.xml index 945981f69999..f867538d5037 100644 --- a/src/Uno.UI/LinkerDefinition.Wasm.xml +++ b/src/Uno.UI/LinkerDefinition.Wasm.xml @@ -54,9 +54,6 @@ - - - diff --git a/src/Uno.UWP/Devices/Sensors/LightSensor.cs b/src/Uno.UWP/Devices/Sensors/LightSensor.cs index e5f54b8fa827..924ef1d6bb4a 100644 --- a/src/Uno.UWP/Devices/Sensors/LightSensor.cs +++ b/src/Uno.UWP/Devices/Sensors/LightSensor.cs @@ -2,6 +2,7 @@ #nullable enable using System; +using System.Diagnostics.CodeAnalysis; using Uno.Helpers; using Windows.Foundation; @@ -17,6 +18,9 @@ public partial class LightSensor private readonly StartStopEventWrapper> _readingChangedWrapper; +#if __WASM__ + [DynamicDependency(nameof(DispatchReading))] +#endif private LightSensor() { _readingChangedWrapper = new StartStopEventWrapper>( diff --git a/src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs b/src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs index 1a65281316e2..7efd2bef0271 100644 --- a/src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs +++ b/src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs @@ -32,7 +32,6 @@ private void StopReading() Uno.Foundation.WebAssemblyRuntime.InvokeJS(command); } - [Preserve] public static int DispatchReading(float lux) { var reading = new LightSensorReading(lux, DateTimeOffset.UtcNow);