From 816e2389f9a8c49ab5436ed7eb081f65c9a6916f Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Mon, 14 Apr 2025 16:19:29 +0200 Subject: [PATCH 1/9] Remove SecurityHelper from PBT/RF compilation (cherry picked from commit 0c1382637811530975633cc98d6e4fd09900f210) --- .../PresentationBuildTasks.csproj | 3 --- .../System/Windows/Markup/XmlnsCache.cs | 4 +--- .../src/ReachFramework/ReachFramework.csproj | 1 - .../src/Shared/MS/Internal/SecurityHelper.cs | 19 ++----------------- .../CompoundFile/ContainerUtilities.cs | 6 +----- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj index c8583201b02..bfdd1716c05 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj +++ b/src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/PresentationBuildTasks.csproj @@ -73,9 +73,6 @@ Shared\MS\Internal\ReflectionUtils.cs - - Shared\MS\Internal\SecurityHelper.cs - Shared\MS\Internal\TokenizerHelper.cs diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlnsCache.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlnsCache.cs index 69c5550f182..5cc34e38085 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlnsCache.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XmlnsCache.cs @@ -14,9 +14,7 @@ using System.Linq; using System.Reflection; using MS.Utility; -#if PBTCOMPILER -using MS.Internal.PresentationBuildTasks; -#else +#if !PBTCOMPILER using MS.Internal.PresentationFramework; using MS.Internal.Utility; // AssemblyCacheEnum #endif diff --git a/src/Microsoft.DotNet.Wpf/src/ReachFramework/ReachFramework.csproj b/src/Microsoft.DotNet.Wpf/src/ReachFramework/ReachFramework.csproj index 1f0244eb90b..8565543b468 100644 --- a/src/Microsoft.DotNet.Wpf/src/ReachFramework/ReachFramework.csproj +++ b/src/Microsoft.DotNet.Wpf/src/ReachFramework/ReachFramework.csproj @@ -51,7 +51,6 @@ - diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs index 253a139e39e..a089867572c 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SecurityHelper.cs @@ -7,29 +7,18 @@ * \***************************************************************************/ -using System.Security; using System.ComponentModel; using System.Runtime.InteropServices; using Microsoft.Win32; -#if !PBTCOMPILER -using MS.Win32; -using System.IO.Packaging; -#endif - #if PRESENTATION_CORE using MS.Internal.AppModel; +using System.Security; +using MS.Win32; #endif #if PRESENTATIONFRAMEWORK_ONLY -using System.Diagnostics; using System.Windows; -using MS.Internal.Utility; // BindUriHelper -using MS.Internal.AppModel; -#endif - -#if REACHFRAMEWORK -using MS.Internal.Utility; #endif #if WINDOWS_BASE // This existed originally to allow FontCache service to @@ -50,10 +39,6 @@ namespace MS.Internal.WindowsBase namespace MS.Internal // Promote the one from PresentationCore as the default to use. #elif PRESENTATIONFRAMEWORK namespace MS.Internal.PresentationFramework -#elif PBTCOMPILER -namespace MS.Internal.PresentationBuildTasks -#elif REACHFRAMEWORK -namespace MS.Internal.ReachFramework #elif DRT namespace MS.Internal.Drt #else diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/CompoundFile/ContainerUtilities.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/CompoundFile/ContainerUtilities.cs index 574195cd92f..39f7618caf9 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/CompoundFile/ContainerUtilities.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/IO/Packaging/CompoundFile/ContainerUtilities.cs @@ -11,11 +11,7 @@ using System.Text; // for StringBuilder using System.Diagnostics; // for Debug.Assert - -#if PBTCOMPILER -using MS.Utility; // For SR.cs -using MS.Internal.PresentationBuildTasks; -#else +#if !PBTCOMPILER using System.Windows; using MS.Internal.WindowsBase; #endif From 22925c9d0e41fdc28967681b14abdcc9d0bc08ed Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Tue, 22 Oct 2024 20:16:24 +0200 Subject: [PATCH 2/9] Adjust style to be on par with other change (cherry picked from commit 5b0b50e0cee0378e1ec987480574d6aa262666ac) --- .../MS/Internal/documents/DocumentViewerHelper.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentViewerHelper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentViewerHelper.cs index 61d87234bbe..b63f9a0a865 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentViewerHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/documents/DocumentViewerHelper.cs @@ -271,13 +271,9 @@ private static CultureInfo GetDocumentCultureInfo(ITextContainer textContainer) /// FindToolBar instance. internal static void ShowFindUnsuccessfulMessage(FindToolBar findToolBar) { - string messageString; - // No, we did not find anything. Alert the user. - messageString = findToolBar.SearchUp ? - SR.DocumentViewerSearchUpCompleteLabel : - SR.DocumentViewerSearchDownCompleteLabel; - messageString = String.Format(System.Globalization.CultureInfo.CurrentCulture, messageString, findToolBar.SearchText); + string messageString = findToolBar.SearchUp ? SR.DocumentViewerSearchUpCompleteLabel : SR.DocumentViewerSearchDownCompleteLabel; + messageString = string.Format(CultureInfo.CurrentCulture, messageString, findToolBar.SearchText); HwndSource hwndSource = PresentationSource.CriticalFromVisual(findToolBar) as HwndSource; IntPtr hwnd = (hwndSource != null) ? hwndSource.Handle : IntPtr.Zero; From 1ba699b3ff57d2282d3dd2db7f5d1f62942ad45d Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Tue, 22 Oct 2024 23:00:50 +0200 Subject: [PATCH 3/9] Fix invalid value write to CellsPanelHorizontalOffset and infinite loop (cherry picked from commit 72d18653d4acfc1dc651c48fc5d78252a3e35e3d) --- .../System/Windows/Controls/DataGrid.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGrid.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGrid.cs index ecf1a7c7bd4..64a4b8d5745 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGrid.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/DataGrid.cs @@ -8464,9 +8464,13 @@ private object InvalidateCellsPanelHorizontalOffset(object args) IProvideDataGridColumn cell = GetAnyCellOrColumnHeader(); if (cell != null) { - CellsPanelHorizontalOffset = DataGridHelper.GetParentCellsPanelHorizontalOffset(cell); + // Due to layout rounding, computation of the offset may return a negative value while computing the difference between controls, + // however since this offset is used also for Button's Width servicing the DataGrid.SelectAllCommand in all standard styles, + // we cannot accept this. Even if we could, the DataGrid[CellsPanel] layout logic depends on this offset being 0 or greater. + // See https://github.com/dotnet/wpf/pull/9983 for more information regarding this. + CellsPanelHorizontalOffset = Math.Max(0d, DataGridHelper.GetParentCellsPanelHorizontalOffset(cell)); } - else if (!Double.IsNaN(RowHeaderWidth)) + else if (!double.IsNaN(RowHeaderWidth)) { CellsPanelHorizontalOffset = RowHeaderWidth; } From 7e97bb591f1a488a887f8ec569be4b279fa38aa5 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Sat, 26 Oct 2024 22:40:32 +0200 Subject: [PATCH 4/9] Remember to not make FrugalStructList readonly, dummy (cherry picked from commit ef0a28d5d65625e624781f064dc54ba5a0e2d61a) --- .../src/PresentationFramework/System/Windows/Style.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Style.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Style.cs index eb193cd8f14..df8b15b2d11 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Style.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Style.cs @@ -954,7 +954,7 @@ private static bool IsEqual(object a, object b) // Original Style data (not including based-on data) // Synchronized (write locks, lock-free reads): Covered by Style instance lock - /* property */ internal FrugalStructList PropertyValues = new FrugalStructList(); + internal FrugalStructList PropertyValues = new(); // Properties driven on the container (by the Style) that should be // invalidated when the style gets applied/unapplied. These properties From dc205694b8b97d660dcdb653d933c1a1bef91449 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Thu, 9 Jan 2025 17:23:10 +0100 Subject: [PATCH 5/9] Replace ArrayList in HwndHost with generic List (cherry picked from commit 24c293c18989b3c2786597a4593e80bdb9bcefc9) --- .../System/Windows/Interop/HwndHost.cs | 37 +++++++------------ 1 file changed, 14 insertions(+), 23 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/HwndHost.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/HwndHost.cs index 892eee06208..4c540de4dcb 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/HwndHost.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/HwndHost.cs @@ -85,23 +85,17 @@ public event HwndSourceHook MessageHook { add { - - if(_hooks == null) - { - _hooks = new ArrayList(8); - } + _hooks ??= new List(8); _hooks.Add(value); } - remove { - - if(_hooks != null) + if (_hooks is not null) { _hooks.Remove(value); - if(_hooks.Count == 0) + if (_hooks.Count == 0) { _hooks = null; } @@ -1101,22 +1095,19 @@ private object AsyncDestroyWindow(object arg) private IntPtr SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) { - IntPtr result = IntPtr.Zero ; + // Call the virtual first + IntPtr result = WndProc(hwnd, msg, wParam, lParam, ref handled); - // Call the virtual first. - result = WndProc(hwnd, msg, wParam, lParam, ref handled); + if (_hooks is null || handled) + return result; - // Call the handlers for the MessageHook event. - if(!handled && _hooks != null) + // Call the handlers for the MessageHook event + for (int i = 0, nCount = _hooks.Count; i < nCount; i++) { - for(int i = 0, nCount = _hooks.Count; i < nCount; i++) - { - result = ((HwndSourceHook)_hooks[i])(hwnd, msg, wParam, lParam, ref handled); - if(handled) - { - break; - } - } + result = _hooks[i].Invoke(hwnd, msg, wParam, lParam, ref handled); + + if (handled) + break; } return result; @@ -1132,7 +1123,7 @@ private IntPtr SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lPara private HandleRef _hwnd; - private ArrayList _hooks; + private List _hooks; private Size _desiredSize; /// From a9673712513788dec161facbfca0dc6996b946c6 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Mon, 20 Jan 2025 17:23:51 +0100 Subject: [PATCH 6/9] Define new constructs out of generated file (cherry picked from commit 87417287db1fe37eccea7b973e82a9e80bf923df) --- .../PresentationCore/PresentationCore.csproj | 1 + .../System/Windows/Media/DoubleCollection.cs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/DoubleCollection.cs diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj b/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj index f7b4b4c031e..481b9c49b48 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/PresentationCore.csproj @@ -714,6 +714,7 @@ + diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/DoubleCollection.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/DoubleCollection.cs new file mode 100644 index 00000000000..f4a965d79e8 --- /dev/null +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/DoubleCollection.cs @@ -0,0 +1,23 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using MS.Utility; + +namespace System.Windows.Media; + +public sealed partial class DoubleCollection +{ + /// + /// Initializes a new instance using a . Elements are copied. + /// + /// + internal DoubleCollection(params ReadOnlySpan values) + { + _collection = new FrugalStructList(values.Length); + + foreach (double item in values) + { + _collection.Add(item); + } + } +} From ea25409778d8a8020cbbacd75c27f97a37a54873 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Sun, 26 Jan 2025 11:13:04 +0100 Subject: [PATCH 7/9] Fix InvalidCastException in Can/ConvertTo (cherry picked from commit 3a1c6d1b91d82e977c3a2957d5f8a0ec530bf910) --- .../Input/Command/MouseActionConverter.cs | 23 +++++++------- .../Input/MouseActionConverter.Tests.cs | 30 +++++-------------- 2 files changed, 19 insertions(+), 34 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseActionConverter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseActionConverter.cs index fe804828b30..c69a7b1226e 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseActionConverter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Input/Command/MouseActionConverter.cs @@ -7,12 +7,12 @@ namespace System.Windows.Input { /// - /// Converter class for converting between a and . + /// Converter class for converting between a and . /// public class MouseActionConverter : TypeConverter { /// - /// Used to check whether we can convert a into a . + /// Used to check whether we can convert a into a . /// ///ITypeDescriptorContext ///type to convert from @@ -24,11 +24,11 @@ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceT } /// - /// Used to check whether we can convert specified value to . + /// Used to check whether we can convert specified value to . /// /// ITypeDescriptorContext /// Type to convert to - /// if conversion to is possible, otherwise. + /// if conversion to is possible, otherwise. public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { // We can convert to an InstanceDescriptor or to a string @@ -36,20 +36,20 @@ public override bool CanConvertTo(ITypeDescriptorContext context, Type destinati return false; // When invoked by the serialization engine we can convert to string only for known type - if (context is null || context.Instance is null) + if (context?.Instance is not MouseAction mouseAction) return false; // Make sure the value falls within defined set - return IsDefinedMouseAction((MouseAction)context.Instance); + return IsDefinedMouseAction(mouseAction); } /// - /// Converts of type to its represensation. + /// Converts of type to its representation. /// /// Parser Context /// Culture Info /// MouseAction String - /// A representing the specified by . + /// A representing the specified by . public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object source) { if (source is not string mouseAction) @@ -72,21 +72,20 @@ _ when mouseActionToken.Equals("MiddleDoubleClick", StringComparison.OrdinalIgno } /// - /// Converts a of to its represensation. + /// Converts a of to its representation. /// /// Serialization Context /// Culture Info /// MouseAction value /// Type to Convert - /// A representing the specified by . + /// A representing the specified by . public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { ArgumentNullException.ThrowIfNull(destinationType); - if (value is null || destinationType != typeof(string)) + if (value is not MouseAction mouseAction || destinationType != typeof(string)) throw GetConvertToException(value, destinationType); - MouseAction mouseAction = (MouseAction)value; return mouseAction switch { MouseAction.None => string.Empty, diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/System/Windows/Input/MouseActionConverter.Tests.cs b/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/System/Windows/Input/MouseActionConverter.Tests.cs index 5fa2efad7d3..b189f9ffb92 100644 --- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/System/Windows/Input/MouseActionConverter.Tests.cs +++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/System/Windows/Input/MouseActionConverter.Tests.cs @@ -23,7 +23,7 @@ public void CanConvertFrom_ReturnsExpected(bool expected, Type sourceType) } [Theory] - [MemberData(nameof(CanConvertTo_Data))] + [MemberData(nameof(CanConvertTo_ReturnsExpected_Data))] public void CanConvertTo_ReturnsExpected(bool expected, bool passContext, object? value, Type? destinationType) { MouseActionConverter converter = new(); @@ -32,7 +32,7 @@ public void CanConvertTo_ReturnsExpected(bool expected, bool passContext, object Assert.Equal(expected, converter.CanConvertTo(passContext ? context : null, destinationType)); } - public static IEnumerable CanConvertTo_Data + public static IEnumerable CanConvertTo_ReturnsExpected_Data { get { @@ -46,6 +46,8 @@ public static IEnumerable CanConvertTo_Data // Unsupported cases yield return new object[] { false, false, MouseAction.None, typeof(string) }; yield return new object[] { false, false, MouseAction.MiddleDoubleClick, typeof(string) }; + yield return new object[] { false, true, (int)MouseAction.MiddleDoubleClick, typeof(string) }; + yield return new object[] { false, true, (short)MouseAction.LeftDoubleClick, typeof(string) }; yield return new object?[] { false, true, null, typeof(MouseAction) }; yield return new object?[] { false, true, null, typeof(string) }; yield return new object?[] { false, false, MouseAction.MiddleDoubleClick, typeof(string) }; @@ -56,16 +58,6 @@ public static IEnumerable CanConvertTo_Data } } - [Fact] - public void CanConvertTo_ThrowsInvalidCastException() - { - MouseActionConverter converter = new(); - StandardContextImpl context = new() { Instance = 10 }; - - // TODO: CanConvert* methods should not throw but the implementation is faulty - Assert.Throws(() => converter.CanConvertTo(context, typeof(string))); - } - [Theory] [MemberData(nameof(ConvertFrom_ReturnsExpected_Data))] public void ConvertFrom_ReturnsExpected(MouseAction expected, ITypeDescriptorContext context, CultureInfo? cultureInfo, string value) @@ -156,6 +148,9 @@ public void ConvertTo_ThrowsArgumentNullException() [Theory] // Unsupported value [InlineData(null, typeof(string))] + // Unsupported unboxing casts + [InlineData((int)MouseAction.RightClick, typeof(string))] + [InlineData((short)MouseAction.LeftDoubleClick, typeof(string))] // Unsupported destinationType [InlineData(MouseAction.None, typeof(int))] [InlineData(MouseAction.LeftClick, typeof(byte))] @@ -166,21 +161,12 @@ public void ConvertTo_ThrowsNotSupportedException(object? value, Type destinatio Assert.Throws(() => converter.ConvertTo(value, destinationType)); } - [Fact] - public void ConvertTo_ThrowsInvalidCastException() - { - MouseActionConverter converter = new(); - - // TODO: This should not throw InvalidCastException but NotSupportedException - Assert.Throws(() => converter.ConvertTo(null, null, (int)(MouseAction.MiddleDoubleClick), typeof(string))); - } - [Fact] public void ConvertTo_ThrowsInvalidEnumArgumentException() { MouseActionConverter converter = new(); - Assert.Throws(() => converter.ConvertTo(null, null, (MouseAction)(MouseAction.MiddleDoubleClick + 1), typeof(string))); + Assert.Throws(() => converter.ConvertTo(null, null, MouseAction.MiddleDoubleClick + 1, typeof(string))); } public sealed class StandardContextImpl : ITypeDescriptorContext From a014ccabdf5c9961ceaaabf407b13a21c005a83c Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Thu, 27 Mar 2025 19:08:16 +0100 Subject: [PATCH 8/9] Remove empty NativeMethods (cherry picked from commit b1d5aa5bbf0c6045d97f798b3f97aab5ed97cd8d) --- .../Windows/Media/NativeMethodsMilCoreApi.cs | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/NativeMethodsMilCoreApi.cs diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/NativeMethodsMilCoreApi.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/NativeMethodsMilCoreApi.cs deleted file mode 100644 index f801b630ebd..00000000000 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/NativeMethodsMilCoreApi.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -//------------------------------------------------------------------------------ -// -// -// ABOUT THIS FILE: -// -- This file contains native methods which are deemed NOT SAFE for partial trust callers -// -- These methods DO NOT have the SuppressUnmanagedCodeSecurity attribute on them -// which means stalk walks for unmanaged code will bubble all the way up the stack -// -- Put methods in here which are not needed in partial trust scenarios and/or when a stack walk is -// appropriate -// -- If you have questions about how to use this file, email avsee -//----------------------------------------------------------------------------- - -namespace MS.Win32 -{ - using Accessibility; - using System.Runtime.InteropServices; - using System; - using System.Collections; - using System.Diagnostics; - using System.IO; - using System.Text; - using Microsoft.Win32; - using System.Windows.Media.Composition; - - internal static partial class NativeMethods - { - } -} - From ebb958a07105ca218a47f849c249588c119f5e1d Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Sun, 6 Apr 2025 20:50:34 +0200 Subject: [PATCH 9/9] Replace Box(true) -> TrueBox (cherry picked from commit 52c25da21fa88ad1b6a7a7c7a4698aedad632bbf) --- .../System/Windows/Controls/GridViewColumnHeader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/GridViewColumnHeader.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/GridViewColumnHeader.cs index 58490630aa8..2ee7b861f65 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/GridViewColumnHeader.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/GridViewColumnHeader.cs @@ -856,7 +856,7 @@ private bool HandleIsMouseOverChanged() (_headerGripper == null || !_headerGripper.IsMouseOver)) { // Hovering over the button will click in the OnHover click mode - SetValue(IsPressedPropertyKey, BooleanBoxes.Box(true)); + SetValue(IsPressedPropertyKey, BooleanBoxes.TrueBox); OnClick(); } else