From 83ac49badbf92a0f6497b3180d5bfb45b28a0ae9 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 11:19:06 -0700 Subject: [PATCH 01/11] Add trim annotations to managed projects --- .../Core/CallMethodAction.cs | 3 ++ .../Core/ChangePropertyAction.cs | 3 ++ .../Core/DataBindingHelper.cs | 12 ++++- .../Core/DataTriggerBehavior.cs | 3 ++ .../Core/EventTriggerBehavior.cs | 46 +++++++++++-------- .../Core/GoToStateAction.cs | 2 +- 6 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs index 73d0dbea..2691fdc2 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs @@ -21,6 +21,9 @@ namespace Microsoft.Xaml.Interactions.Core /// /// An action that calls a method on a specified object when invoked. /// +#if NET5_0_OR_GREATER + [RequiresUnreferencedCode("This action is not trim-safe.")] +#endif public sealed class CallMethodAction : DependencyObject, IAction { /// diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs index ec8ae226..91d52143 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs @@ -19,6 +19,9 @@ namespace Microsoft.Xaml.Interactions.Core /// /// An action that will change a specified property to a specified value when invoked. /// +#if NET5_0_OR_GREATER + [RequiresUnreferencedCode("This action is not trim-safe.")] +#endif public sealed class ChangePropertyAction : DependencyObject, IAction { /// diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs index db0550af..2d975f49 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs @@ -3,6 +3,9 @@ using System; using System.Collections.Generic; +#if NET5_0_OR_GREATER +using System.Diagnostics.CodeAnalysis; +#endif using System.Reflection; using Microsoft.Xaml.Interactivity; @@ -29,6 +32,9 @@ internal static class DataBindingHelper /// bindings on the action may not be up-to-date. This routine is called before the action /// is executed in order to guarantee that all bindings are refreshed with the most current data. /// +#if NET5_0_OR_GREATER + [RequiresUnreferencedCode("This method accesses all fields of input action objects.")] +#endif public static void RefreshDataBindingsOnActions(ActionCollection actions) { foreach (DependencyObject action in actions) @@ -40,7 +46,11 @@ public static void RefreshDataBindingsOnActions(ActionCollection actions) } } - private static IEnumerable GetDependencyProperties(Type type) + private static IEnumerable GetDependencyProperties( +#if NET5_0_OR_GREATER + [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] +#endif + Type type) { List propertyList = null; diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs index 4b9f7dc8..cb30663c 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs @@ -18,6 +18,9 @@ namespace Microsoft.Xaml.Interactions.Core /// /// A behavior that performs actions when the bound data meets a specified condition. /// +#if NET5_0_OR_GREATER + [RequiresUnreferencedCode("This behavior is not trim-safe.")] +#endif public sealed class DataTriggerBehavior : Trigger { /// diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs index 64168050..1408fa33 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs @@ -21,6 +21,9 @@ namespace Microsoft.Xaml.Interactions.Core /// /// A behavior that listens for a specified event on its source and executes its actions when that event is fired. /// +#if NET5_0_OR_GREATER + [RequiresUnreferencedCode("This behavior is not trim-safe.")] +#endif public sealed class EventTriggerBehavior : Trigger { /// @@ -181,7 +184,7 @@ private void RegisterEvent(string eventName) else if (!this._isLoadedEventRegistered) { FrameworkElement element = this._resolvedSource as FrameworkElement; - if (element != null && !EventTriggerBehavior.IsElementLoaded(element)) + if (element != null && !EventTriggerBehaviorHelpers.IsElementLoaded(element)) { this._isLoadedEventRegistered = true; element.Loaded += this.OnEvent; @@ -253,7 +256,29 @@ private static void OnEventNameChanged(DependencyObject dependencyObject, Depend behavior.RegisterEvent(newEventName); } - internal static bool IsElementLoaded(FrameworkElement element) + private static bool IsWindowsRuntimeEvent(EventInfo eventInfo) + { + return eventInfo != null && + EventTriggerBehavior.IsWindowsRuntimeType(eventInfo.EventHandlerType) && + EventTriggerBehavior.IsWindowsRuntimeType(eventInfo.DeclaringType); + } + + private static bool IsWindowsRuntimeType(Type type) + { + if (type != null) + { + return type.AssemblyQualifiedName.EndsWith("ContentType=WindowsRuntime", StringComparison.Ordinal); + } + + return false; + } + } + + internal static class EventTriggerBehaviorHelpers + { + // This method has to be outside of 'EventTriggerBehavior', because it's actually trim-safe. + // We want to allow other callers inside the library use this without getting trim warnings. + public static bool IsElementLoaded(FrameworkElement element) { if (element == null) { @@ -280,22 +305,5 @@ internal static bool IsElementLoaded(FrameworkElement element) return (parent != null || (rootVisual != null && element == rootVisual)); } - - private static bool IsWindowsRuntimeEvent(EventInfo eventInfo) - { - return eventInfo != null && - EventTriggerBehavior.IsWindowsRuntimeType(eventInfo.EventHandlerType) && - EventTriggerBehavior.IsWindowsRuntimeType(eventInfo.DeclaringType); - } - - private static bool IsWindowsRuntimeType(Type type) - { - if (type != null) - { - return type.AssemblyQualifiedName.EndsWith("ContentType=WindowsRuntime", StringComparison.Ordinal); - } - - return false; - } } } diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/GoToStateAction.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/GoToStateAction.cs index 31249565..7e99f18c 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/GoToStateAction.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/GoToStateAction.cs @@ -127,7 +127,7 @@ public object Execute(object sender, object parameter) } FrameworkElement element = sender as FrameworkElement; - if (element == null || !EventTriggerBehavior.IsElementLoaded(element)) + if (element == null || !EventTriggerBehaviorHelpers.IsElementLoaded(element)) { return false; } From 8d772c351975ee3453086221022ec2d0615671dd Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 11:24:03 -0700 Subject: [PATCH 02/11] Update global.json --- src/BehaviorsSDKManaged/global.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/BehaviorsSDKManaged/global.json b/src/BehaviorsSDKManaged/global.json index 5b494ccc..2e7cd110 100644 --- a/src/BehaviorsSDKManaged/global.json +++ b/src/BehaviorsSDKManaged/global.json @@ -1,7 +1,8 @@ { "sdk": { - "version": "5.0.403" + "version": "8.0.300", + "rollForward": "latestFeature" }, "msbuild-sdks": { "MSBuild.Sdk.Extras": "3.0.23" From 4c474785237dbfd81a03e1877d15546e9243aafd Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 11:30:13 -0700 Subject: [PATCH 03/11] Update ifdef conditions for .NET --- .../Core/CallMethodAction.cs | 2 +- .../Core/ChangePropertyAction.cs | 2 +- .../Core/DataBindingHelper.cs | 6 +++--- .../Core/DataTriggerBehavior.cs | 2 +- .../Core/EventTriggerBehavior.cs | 2 +- .../Core/ResourceHelper.cs | 4 ++-- .../Microsoft.Xaml.Interactivity.Shared/ResourceHelper.cs | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs index 2691fdc2..37ec79a8 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/CallMethodAction.cs @@ -21,7 +21,7 @@ namespace Microsoft.Xaml.Interactions.Core /// /// An action that calls a method on a specified object when invoked. /// -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER [RequiresUnreferencedCode("This action is not trim-safe.")] #endif public sealed class CallMethodAction : DependencyObject, IAction diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs index 91d52143..a0e63b4c 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ChangePropertyAction.cs @@ -19,7 +19,7 @@ namespace Microsoft.Xaml.Interactions.Core /// /// An action that will change a specified property to a specified value when invoked. /// -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER [RequiresUnreferencedCode("This action is not trim-safe.")] #endif public sealed class ChangePropertyAction : DependencyObject, IAction diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs index 2d975f49..a1c3680c 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataBindingHelper.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER using System.Diagnostics.CodeAnalysis; #endif using System.Reflection; @@ -32,7 +32,7 @@ internal static class DataBindingHelper /// bindings on the action may not be up-to-date. This routine is called before the action /// is executed in order to guarantee that all bindings are refreshed with the most current data. /// -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER [RequiresUnreferencedCode("This method accesses all fields of input action objects.")] #endif public static void RefreshDataBindingsOnActions(ActionCollection actions) @@ -47,7 +47,7 @@ public static void RefreshDataBindingsOnActions(ActionCollection actions) } private static IEnumerable GetDependencyProperties( -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] #endif Type type) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs index cb30663c..57fda588 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/DataTriggerBehavior.cs @@ -18,7 +18,7 @@ namespace Microsoft.Xaml.Interactions.Core /// /// A behavior that performs actions when the bound data meets a specified condition. /// -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER [RequiresUnreferencedCode("This behavior is not trim-safe.")] #endif public sealed class DataTriggerBehavior : Trigger diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs index 1408fa33..1d735a62 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs @@ -21,7 +21,7 @@ namespace Microsoft.Xaml.Interactions.Core /// /// A behavior that listens for a specified event on its source and executes its actions when that event is fired. /// -#if NET5_0_OR_GREATER +#if NET8_0_OR_GREATER [RequiresUnreferencedCode("This behavior is not trim-safe.")] #endif public sealed class EventTriggerBehavior : Trigger diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ResourceHelper.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ResourceHelper.cs index 73ad44f0..7884c6f3 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ResourceHelper.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/ResourceHelper.cs @@ -7,13 +7,13 @@ namespace Microsoft.Xaml.Interactions.Core internal static class ResourceHelper { -#if NET5_0 +#if NET8_0_OR_GREATER private static ResourceLoader strings = new ResourceLoader(ResourceLoader.GetDefaultResourceFilePath(), "Microsoft.Xaml.Interactions/Strings"); #endif public static string GetString(string resourceName) { -#if !NET5_0 +#if !NET8_0_OR_GREATER var strings = ResourceLoader.GetForCurrentView("Microsoft.Xaml.Interactions/Strings"); #endif return strings.GetString(resourceName); diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/ResourceHelper.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/ResourceHelper.cs index 07c287a4..fc4cbc4b 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/ResourceHelper.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/ResourceHelper.cs @@ -6,13 +6,13 @@ namespace Microsoft.Xaml.Interactivity internal static class ResourceHelper { -#if NET5_0 +#if NET8_0_OR_GREATER private static ResourceLoader strings = new ResourceLoader(ResourceLoader.GetDefaultResourceFilePath(), "Microsoft.Xaml.Interactivity/Strings"); #endif public static string GetString(string resourceName) { -#if !NET5_0 +#if !NET8_0_OR_GREATER ResourceLoader strings = ResourceLoader.GetForCurrentView("Microsoft.Xaml.Interactivity/Strings"); #endif return strings.GetString(resourceName); From 294628140d727454fc420332744ffa4deac9c520 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 11:34:12 -0700 Subject: [PATCH 04/11] Fix a warning --- .../Microsoft.Xaml.Interactivity.Shared/BehaviorCollection.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/BehaviorCollection.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/BehaviorCollection.cs index 1a57482a..b55f1727 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/BehaviorCollection.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Shared/BehaviorCollection.cs @@ -187,7 +187,7 @@ private void VerifyOldCollectionIntegrity() { for (int i = 0; i < this.Count; i++) { - if (this[i] != this._oldCollection[i]) + if (!ReferenceEquals(this[i], this._oldCollection[i])) { isValid = false; break; From 0df5defe0514b4f44907c70774e6ef9e4445f5c6 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 11:34:45 -0700 Subject: [PATCH 05/11] Bump to .NET 8, update WASDK dependency --- ...rosoft.Xaml.Behaviors.WinUI.Managed.nuspec | 34 +++++++++---------- .../Microsoft.Xaml.Interactions.WinUI.csproj | 7 ++-- .../Microsoft.Xaml.Interactivity.WinUI.csproj | 7 ++-- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec b/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec index 0f256998..b041cb57 100644 --- a/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec +++ b/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec @@ -14,33 +14,33 @@ © Microsoft Corporation. All rights reserved. Behavior Action Behaviors Actions Blend Managed C# Interaction Interactivity Interactions WinUI - + - - - - - - - - + + + + + + + + - - - - + + + + diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj index 345cd4e3..d5a5b2bb 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj @@ -1,10 +1,11 @@  Library - net5.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 10.0.17763.0 Microsoft.Xaml.Interactions - AnyCPU;x86;x64 + AnyCPU;x86;x64;arm64 + win-x86;win-x64;win-arm64 10.0.17763.0 $(TargetPlatformMinVersion) false @@ -122,7 +123,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj index fa160f75..7c8cfb46 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj @@ -1,10 +1,11 @@  Library - net5.0-windows10.0.17763.0 + net8.0-windows10.0.17763.0 10.0.17763.0 Microsoft.Xaml.Interactivity - AnyCPU;x86;x64 + AnyCPU;x86;x64;arm64 + win-x86;win-x64;win-arm64 10.0.17763.0 $(TargetPlatformMinVersion) false @@ -118,7 +119,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From e17deeb8de364570bbffa87b1b936cabf8e787fe Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 11:35:19 -0700 Subject: [PATCH 06/11] Set 'IsAotCompatible' --- .../Microsoft.Xaml.Interactions.WinUI.csproj | 1 + .../Microsoft.Xaml.Interactivity.WinUI.csproj | 1 + 2 files changed, 2 insertions(+) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj index d5a5b2bb..b29d45ed 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj @@ -9,6 +9,7 @@ 10.0.17763.0 $(TargetPlatformMinVersion) false + true AnyCPU diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj index 7c8cfb46..54a68adb 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.WinUI/Microsoft.Xaml.Interactivity.WinUI.csproj @@ -9,6 +9,7 @@ 10.0.17763.0 $(TargetPlatformMinVersion) false + true ..\..\..\out\WinUI\$(SolutionName)\bin\$(Platform)\$(Configuration)\ From 67c6bf5b8d76a68d5e3f067ff4832e470499da16 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 13:18:03 -0700 Subject: [PATCH 07/11] Bump WASDK dependency in .nuspec file --- scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec b/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec index b041cb57..5adfd1f8 100644 --- a/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec +++ b/scripts/Microsoft.Xaml.Behaviors.WinUI.Managed.nuspec @@ -15,7 +15,7 @@ Behavior Action Behaviors Actions Blend Managed C# Interaction Interactivity Interactions WinUI - + From 23a5cad711edaf64a366bc4e3b157d27b0222d68 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 13:25:10 -0700 Subject: [PATCH 08/11] Add ifdef for legacy code, for clarity --- .../Core/EventTriggerBehavior.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs index 1d735a62..6b3591ec 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Shared/Core/EventTriggerBehavior.cs @@ -256,6 +256,7 @@ private static void OnEventNameChanged(DependencyObject dependencyObject, Depend behavior.RegisterEvent(newEventName); } +#if !WinUI private static bool IsWindowsRuntimeEvent(EventInfo eventInfo) { return eventInfo != null && @@ -267,11 +268,14 @@ private static bool IsWindowsRuntimeType(Type type) { if (type != null) { + // This will only work when using built-in WinRT interop, ie. where .winmd files are directly + // referenced instead of generated projections. That is, this would not work on modern .NET. return type.AssemblyQualifiedName.EndsWith("ContentType=WindowsRuntime", StringComparison.Ordinal); } return false; } +#endif } internal static class EventTriggerBehaviorHelpers From f4d5c50c9509f6505f27d06a5137d509206ec540 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 15:50:18 -0700 Subject: [PATCH 09/11] Update 'NuGet.Build.Tasks.Pack' --- .../Microsoft.Xaml.Interactions.Design.csproj | 4 ++-- .../Microsoft.Xaml.Interactions.Design/packages.config | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj index 2d5e0852..4da2a67b 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj @@ -133,8 +133,8 @@ - + - + \ No newline at end of file diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config index 0706e41e..f36b1a0b 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file From a5282ff820ccac5c48a03c2af849ea503423638f Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Jul 2024 15:53:31 -0700 Subject: [PATCH 10/11] Update 'Microsoft.VisualStudioEng.MicroBuild.Core' --- .../Microsoft.Xaml.Interactions.Design.csproj | 8 ++++---- .../Microsoft.Xaml.Interactions.Design/packages.config | 2 +- .../Microsoft.Xaml.Interactions.DesignTools.csproj | 6 +++--- .../Microsoft.Xaml.Interactions.WinUI.csproj | 2 +- .../Microsoft.Xaml.Interactions.csproj | 4 +++- .../Microsoft.Xaml.Interactivity.Design.csproj | 8 ++++---- .../Microsoft.Xaml.Interactivity.Design/packages.config | 2 +- .../Microsoft.Xaml.Interactivity.DesignTools.csproj | 2 +- .../Microsoft.Xaml.Interactivity.WinUI.csproj | 2 +- .../Microsoft.Xaml.Interactivity.csproj | 4 +++- .../Microsoft.Xaml.Interactions.Design.csproj | 2 +- .../Microsoft.Xaml.Interactions.DesignTools.csproj | 2 +- .../Microsoft.Xaml.Interactions.vcxproj | 8 ++++---- .../Microsoft.Xaml.Interactions/packages.config | 2 +- .../Microsoft.Xaml.Interactivity.Design.csproj | 2 +- .../Microsoft.Xaml.Interactivity.DesignTools.csproj | 2 +- .../Microsoft.Xaml.Interactivity.vcxproj | 8 ++++---- .../Microsoft.Xaml.Interactivity/packages.config | 2 +- 18 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj index 4da2a67b..eab3d68d 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/Microsoft.Xaml.Interactions.Design.csproj @@ -1,6 +1,6 @@  - + Debug @@ -131,10 +131,10 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - + \ No newline at end of file diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config index f36b1a0b..c9d436c0 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.Design/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.DesignTools/Microsoft.Xaml.Interactions.DesignTools.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.DesignTools/Microsoft.Xaml.Interactions.DesignTools.csproj index 1f9b424f..a186cbff 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.DesignTools/Microsoft.Xaml.Interactions.DesignTools.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.DesignTools/Microsoft.Xaml.Interactions.DesignTools.csproj @@ -101,12 +101,12 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - 0.4.1 + 1.0.0 runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj index b29d45ed..694e9f9c 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions.WinUI/Microsoft.Xaml.Interactions.WinUI.csproj @@ -120,7 +120,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.csproj index 513cdbd9..d4ee71f9 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactions/Microsoft.Xaml.Interactions.csproj @@ -157,7 +157,9 @@ 6.2.10 - 0.4.1 + 1.0.0 + runtime; build; native; contentfiles; analyzers; buildtransitive + all diff --git a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Design/Microsoft.Xaml.Interactivity.Design.csproj b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Design/Microsoft.Xaml.Interactivity.Design.csproj index e311f3a1..149ad4a1 100644 --- a/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Design/Microsoft.Xaml.Interactivity.Design.csproj +++ b/src/BehaviorsSDKManaged/Microsoft.Xaml.Interactivity.Design/Microsoft.Xaml.Interactivity.Design.csproj @@ -1,6 +1,6 @@  - + Debug @@ -117,10 +117,10 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + - +