From 0639e5cd34c81debb8140ca5dba75e0635fb019c Mon Sep 17 00:00:00 2001 From: David Date: Wed, 18 Oct 2023 20:58:47 -0400 Subject: [PATCH] chore: Update to latests uno --- .../Uno.UI.RuntimeTests.Engine.Mobile.csproj | 6 ++--- ...Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj | 6 ++--- ...Tests.Engine.Skia.Linux.FrameBuffer.csproj | 6 ++--- ...Uno.UI.RuntimeTests.Engine.Skia.WPF.csproj | 6 ++--- .../Uno.UI.RuntimeTests.Engine.Wasm.csproj | 6 ++--- .../Uno.UI.RuntimeTests.Engine.Mobile.csproj | 6 ++--- ...Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj | 6 ++--- ...Tests.Engine.Skia.Linux.FrameBuffer.csproj | 6 ++--- ...Uno.UI.RuntimeTests.Engine.Skia.Wpf.csproj | 6 ++--- .../Uno.UI.RuntimeTests.Engine.Wasm.csproj | 6 ++--- .../Helpers/HotReloadHelper.DevServer.cs | 11 +++++--- .../Library/Helpers/HotReloadHelper.cs | 8 +++--- .../_Compat/MetadataUpdateHandlerAttribute.cs | 25 +++++++++++++++++++ ...o.UI.RuntimeTests.Engine.Library.projitems | 1 + 14 files changed, 67 insertions(+), 38 deletions(-) create mode 100644 src/Uno.UI.RuntimeTests.Engine.Library/Library/_Compat/MetadataUpdateHandlerAttribute.cs diff --git a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj index bc90757..8452e96 100644 --- a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj +++ b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj @@ -22,9 +22,9 @@ osx-x64 - - - + + + diff --git a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj index 1f41071..573e4ec 100644 --- a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj +++ b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj index 6c4c734..b201f23 100644 --- a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj +++ b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.WPF/Uno.UI.RuntimeTests.Engine.Skia.WPF.csproj b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.WPF/Uno.UI.RuntimeTests.Engine.Skia.WPF.csproj index e8a8247..5d39293 100644 --- a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.WPF/Uno.UI.RuntimeTests.Engine.Skia.WPF.csproj +++ b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Skia.WPF/Uno.UI.RuntimeTests.Engine.Skia.WPF.csproj @@ -20,9 +20,9 @@ - - - + + + diff --git a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj index e9e0bb0..ef0bb0c 100644 --- a/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj +++ b/src/TestApp/uwp/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj @@ -44,9 +44,9 @@ - - - + + + diff --git a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj index f32b5cd..8c9779e 100644 --- a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj +++ b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Mobile/Uno.UI.RuntimeTests.Engine.Mobile.csproj @@ -18,9 +18,9 @@ 10.14 - - - + + + diff --git a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj index 7f25f60..1a77bce 100644 --- a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj +++ b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Gtk/Uno.UI.RuntimeTests.Engine.Skia.Gtk.csproj @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj index 807d756..16260e6 100644 --- a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj +++ b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer/Uno.UI.RuntimeTests.Engine.Skia.Linux.FrameBuffer.csproj @@ -16,9 +16,9 @@ - - - + + + diff --git a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Wpf/Uno.UI.RuntimeTests.Engine.Skia.Wpf.csproj b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Wpf/Uno.UI.RuntimeTests.Engine.Skia.Wpf.csproj index 04cde58..c598c10 100644 --- a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Wpf/Uno.UI.RuntimeTests.Engine.Skia.Wpf.csproj +++ b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Skia.Wpf/Uno.UI.RuntimeTests.Engine.Skia.Wpf.csproj @@ -20,9 +20,9 @@ - - - + + + diff --git a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj index 8421a83..2976787 100644 --- a/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj +++ b/src/TestApp/winui/Uno.UI.RuntimeTests.Engine.Wasm/Uno.UI.RuntimeTests.Engine.Wasm.csproj @@ -44,9 +44,9 @@ - - - + + + diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.DevServer.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.DevServer.cs index 5877f7a..6de51d0 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.DevServer.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.DevServer.cs @@ -9,6 +9,7 @@ using System; using System.Collections; using System.IO; +using System.Linq; using System.Net.WebSockets; using System.Reflection; using System.Threading; @@ -50,6 +51,11 @@ public async ValueTask EnsureReady(CancellationToken ct) throw new InvalidOperationException("Dev server is not available."); } + if (RemoteControlClient.Instance.Processors.OfType().FirstOrDefault() is not { } hotReload) + { + throw new InvalidOperationException("App is not configured to accept hot-reload."); + } + var timeout = Task.Delay(ConnectionTimeout, ct); if (await Task.WhenAny(timeout, RemoteControlClient.Instance.WaitForConnection(ct)) == timeout) { @@ -62,10 +68,7 @@ public async ValueTask EnsureReady(CancellationToken ct) _log.LogTrace("Client connected, waiting for dev-server to load the workspace (i.e. initializing roslyn with the solution) ..."); - var processors = typeof(RemoteControlClient).GetField("_processors", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(RemoteControlClient.Instance) as IDictionary ?? throw new InvalidOperationException("Processors is null"); - var processor = processors["hotreload"] as ClientHotReloadProcessor ?? throw new InvalidOperationException("HotReloadProcessor is null"); - var hotReloadReady = typeof(ClientHotReloadProcessor).GetProperty("HotReloadWorkspaceLoaded", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(processor) as Task ?? throw new IOException("HotReloadWorkspaceLoaded is null"); - + var hotReloadReady = hotReload.WaitForWorkspaceLoaded(ct); timeout = Task.Delay(WorkspaceTimeout, ct); if (await Task.WhenAny(timeout, hotReloadReady) == timeout) { diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs index 5fe4b08..c9e0458 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/HotReloadHelper.cs @@ -90,10 +90,10 @@ static HotReloadHelper() TryUseDevServerFileUpdater(); } - if (!IsSupported) - { - TryUseLocalFileUpdater(); - } + //if (!IsSupported) + //{ + // TryUseLocalFileUpdater(); + //} } static partial void TryUseDevServerFileUpdater(); diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/_Compat/MetadataUpdateHandlerAttribute.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/_Compat/MetadataUpdateHandlerAttribute.cs new file mode 100644 index 0000000..a02cf5c --- /dev/null +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/_Compat/MetadataUpdateHandlerAttribute.cs @@ -0,0 +1,25 @@ +#if !UNO_RUNTIMETESTS_DISABLE_LIBRARY && WINDOWS_UWP +#if !IS_UNO_RUNTIMETEST_PROJECT +#pragma warning disable +#endif + + +using System.Diagnostics.CodeAnalysis; + +#nullable enable +namespace System.Reflection.Metadata +{ + /// Indicates that a type that should receive notifications of metadata updates. + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] + public sealed class MetadataUpdateHandlerAttribute : Attribute + { + /// Initializes the attribute. + /// A type that handles metadata updates and that should be notified when any occur. + public MetadataUpdateHandlerAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] Type handlerType) => this.HandlerType = handlerType; + + /// Gets the type that handles metadata updates and that should be notified when any occur. + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] + public Type HandlerType { get; } + } +} +#endif \ No newline at end of file diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Uno.UI.RuntimeTests.Engine.Library.projitems b/src/Uno.UI.RuntimeTests.Engine.Library/Uno.UI.RuntimeTests.Engine.Library.projitems index c445508..86cb3a1 100644 --- a/src/Uno.UI.RuntimeTests.Engine.Library/Uno.UI.RuntimeTests.Engine.Library.projitems +++ b/src/Uno.UI.RuntimeTests.Engine.Library/Uno.UI.RuntimeTests.Engine.Library.projitems @@ -34,6 +34,7 @@ +