From 388c3c8f37dbf8a727e018f94053ad7391deedd4 Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Thu, 24 Oct 2024 20:38:51 +0530 Subject: [PATCH 1/8] Fixed 18937 --- ...uldNotOccurWhenIsClippedToBoundsIsTrue.png | Bin 0 -> 4304 bytes .../TestCases.HostApp/Issues/Issue18937.xaml | 12 +++++++++ .../Issues/Issue18937.xaml.cs | 13 ++++++++++ .../Tests/Issues/Issue18937.cs | 23 ++++++++++++++++++ ...uldNotOccurWhenIsClippedToBoundsIsTrue.png | Bin 0 -> 4538 bytes src/Core/src/Platform/Windows/ContentPanel.cs | 13 +++++++++- 6 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs create mode 100644 src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png new file mode 100644 index 0000000000000000000000000000000000000000..001a3411469dd9c426f83a19cd1fcf59af8ee80a GIT binary patch literal 4304 zcmeAS@N?(olHy`uVBq!ia0y~yV6k9eU^~vj3>3*tJsk<86p}rHd>I(3)EF2VS{N99 z0fib~Fff!FFfhDIU|_JC!N4G1FlSew4NyWNz$e62+R**~|Nj920YCu(0fGMo1^*o! z{xdM_2xkSUVNCLNcVYa`qd5BLf5fL{AsTkcwMxuWrm` z3S?kCc%R9`qFtV!aWDBRLZP3_}caO zH=pqKa+zp*>EBz96jmKNmE8IGwRl+F5l2CGPZ^cM2}c}-Mj4}lFq#rZbHQjX7|jKv zxnMLGjOK#TTripoMsvYvE*Q-PBQ6)b6h8ivQ@dZakJ(43@J`|*+2f+i;tFFDUfFD` zGy9gEvp4q5b@|+5AGmcDc6b5%>#8NL5hW>!C8<`)MX5lF!N|bKMAy(j*T^Kq(Adhv z)XLOY+rYpIh_Z}}Q8eV{r(~v8;@048-hCdZK?80>NoH + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs new file mode 100644 index 000000000000..65bdaa2c20a5 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs @@ -0,0 +1,13 @@ +namespace Maui.Controls.Sample.Issues +{ + + [Issue(IssueTracker.Github, 18937, "[Windows] Setting IsClippedToBound is true inside a Border control will crash on Windows", PlatformAffected.UWP)] + public partial class Issue18937 : ContentPage + { + + public Issue18937() + { + InitializeComponent(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs new file mode 100644 index 000000000000..461a86851bb5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs @@ -0,0 +1,23 @@ +#if !MACCATALYST +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue18937 : _IssuesUITest + { + public Issue18937(TestDevice device) : base(device) { } + + public override string Issue => "[Windows] Setting IsClippedToBound is true inside a Border control will crash on Windows"; + + [Test] + [Category(UITestCategories.Border)] + public void ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue() + { + App.WaitForElement("StackLayout"); + VerifyScreenshot(); + } + } +} +#endif \ No newline at end of file diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png new file mode 100644 index 0000000000000000000000000000000000000000..cdeefe7a20d65fe7224753aa3f19b2023a3ebb92 GIT binary patch literal 4538 zcmeAS@N?(olHy`uVBq!ia0y~yU`b(M;CRQx3=}b(SUv|xDI|LY`7$t6sWC7#v@kII z0tz*}U|=XUU|@Kaz`$TNgMmT3V9u^U8=wSdfKQ0)e;}x@|IfgXbNS;6pde$Cx4R2N z2dk_Hki%Z$>Fdh=f=hzeg5~3v{rVvJ{35>)#`BBHXE8AF@Aq_Z45_&F_Ch1jW&wtc z?$z@yEb>`kd_%yjSWn(M?cW&@pTSYKdz^NlIc#s#S7PDv)9@ zGB7gHH8jvQG6^v>wlX!dGBD9LFt9Q(m^&ps3PnS1eoAIqC2kFGPTqe8)Sv;kp(Ham zwYVfPw*a@E-FN<30`-W1^rTi~rdhcH3IDXT;?xobV+$RHi{E5V1LdXR@&TC@sW}lY xK$G)|GxPHp3=NG;bQBD?RBXmn7Ku=1WMXWlqu?C(R~4v?!PC{xWt~$(695p*f(ZZs literal 0 HcmV?d00001 diff --git a/src/Core/src/Platform/Windows/ContentPanel.cs b/src/Core/src/Platform/Windows/ContentPanel.cs index 1a1dd2545e44..e8a47f6a0515 100644 --- a/src/Core/src/Platform/Windows/ContentPanel.cs +++ b/src/Core/src/Platform/Windows/ContentPanel.cs @@ -1,5 +1,6 @@ using System; using System.Numerics; +using System.Threading.Tasks; using Microsoft.Graphics.Canvas; using Microsoft.Maui.Graphics; #if MAUI_GRAPHICS_WIN2D @@ -162,7 +163,7 @@ void UpdateBorder(IShape? strokeShape) UpdateClip(strokeShape, width, height); } - void UpdateClip(IShape? borderShape, double width, double height) + async void UpdateClip(IShape? borderShape, double width, double height) { if (Content is null) { @@ -182,6 +183,13 @@ void UpdateClip(IShape? borderShape, double width, double height) } var visual = ElementCompositionPreview.GetElementVisual(Content); + + //Without this, when we maximize the window, if the clip is already applied, it throws an exception again + //So, we need to set the clip to null if it's already applied to ensure proper clipping at the end. + if (visual.Clip is not null) + { + visual.Clip = null; + } var compositor = visual.Compositor; PathF? clipPath; @@ -209,6 +217,9 @@ void UpdateClip(IShape? borderShape, double width, double height) // The clip needs to consider the content's offset in case it is in a different position because of a different alignment. geometricClip.Offset = new Vector2(strokeThickness - Content.ActualOffset.X, strokeThickness - Content.ActualOffset.Y); + //Adding Task.Yield ensures that all layouts are properly updated before applying the clip. + await Task.Yield(); + visual.Clip = geometricClip; } } From c5b66828a734e3c5ef63e1598d0a19b1dc255652 Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Mon, 28 Oct 2024 19:30:16 +0530 Subject: [PATCH 2/8] Modified test sample. --- ...uldNotOccurWhenIsClippedToBoundsIsTrue.png | Bin 4304 -> 8613 bytes .../TestCases.HostApp/Issues/Issue18937.xaml | 9 +++++++-- .../Issues/Issue18937.xaml.cs | 1 - .../Tests/Issues/Issue18937.cs | 2 +- ...uldNotOccurWhenIsClippedToBoundsIsTrue.png | Bin 4538 -> 18196 bytes 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png index 001a3411469dd9c426f83a19cd1fcf59af8ee80a..b619c4850a2f3fa685a79c0aefc7cc09a933bc7d 100644 GIT binary patch literal 8613 zcmeI2c~p~ky2l@@6%_~?B!CtzwNm_+}qKmJ7hS z3jiy|qjRqS&Uym8ISLR^4q!*9dhj(CVAbFD@BMDKgIB1*VA#KZzwt?HYik36VA!$4 z05Aqn3(y202Uq}D2ABol1N;IY0GI>lHF^cO3?Kz~4Il;>2518q1Xu)+0Q3VO#;5=q z0Anf~fChkT03v`1fJ^`y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issue18937.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs index 65bdaa2c20a5..af752e74da19 100644 --- a/src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue18937.xaml.cs @@ -4,7 +4,6 @@ [Issue(IssueTracker.Github, 18937, "[Windows] Setting IsClippedToBound is true inside a Border control will crash on Windows", PlatformAffected.UWP)] public partial class Issue18937 : ContentPage { - public Issue18937() { InitializeComponent(); diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs index 461a86851bb5..a9ecd5878ed2 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs @@ -15,7 +15,7 @@ public Issue18937(TestDevice device) : base(device) { } [Category(UITestCategories.Border)] public void ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue() { - App.WaitForElement("StackLayout"); + App.WaitForElement("Label"); VerifyScreenshot(); } } diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png index cdeefe7a20d65fe7224753aa3f19b2023a3ebb92..196bca6f7d251dc1684e820a94de0d2c8dce2a42 100644 GIT binary patch literal 18196 zcmeI4dsGwGzW8IUrB)@jo?cpc^<3+ry(;*qhi6Ewr6~s?B4ENJNfDJILVyq=14(>T zb9=O;iiN6>w51wINFpKvi6L05hzPNghYCq}2WBMUH39=k?r`qow|?ul?pnXUevh@1 zSu3;Gp4oe5KJ$IG|o!C=-!e);(U4CeL27|fg2H(x`0+A7~9qq`5% zzB~|(!2o~3U`~F6!60bY$uSIuxgCQ6zrtWbe#Brraw-(DVd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TC@sW}lY xK$G)|GxPHp3=NG;bQBD?RBXmn7Ku=1WMXWlqu?C(R~4v?!PC{xWt~$(695p*f(ZZs From a81a447c4b4f995fce5e4ebb99f9e9ff7dc6e093 Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Wed, 30 Oct 2024 16:22:35 +0530 Subject: [PATCH 3/8] Updated the fix. --- src/Core/src/Platform/Windows/ContentPanel.cs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Core/src/Platform/Windows/ContentPanel.cs b/src/Core/src/Platform/Windows/ContentPanel.cs index e8a47f6a0515..223ec4a19e92 100644 --- a/src/Core/src/Platform/Windows/ContentPanel.cs +++ b/src/Core/src/Platform/Windows/ContentPanel.cs @@ -184,12 +184,11 @@ async void UpdateClip(IShape? borderShape, double width, double height) var visual = ElementCompositionPreview.GetElementVisual(Content); - //Without this, when we maximize the window, if the clip is already applied, it throws an exception again - //So, we need to set the clip to null if it's already applied to ensure proper clipping at the end. - if (visual.Clip is not null) - { - visual.Clip = null; - } + visual.Clip = null; + + //Adding Task.Yield ensures that all layouts are properly updated before applying the clip. + await Task.Yield(); + var compositor = visual.Compositor; PathF? clipPath; @@ -217,9 +216,6 @@ async void UpdateClip(IShape? borderShape, double width, double height) // The clip needs to consider the content's offset in case it is in a different position because of a different alignment. geometricClip.Offset = new Vector2(strokeThickness - Content.ActualOffset.X, strokeThickness - Content.ActualOffset.Y); - //Adding Task.Yield ensures that all layouts are properly updated before applying the clip. - await Task.Yield(); - visual.Clip = geometricClip; } } From 65b7ea7c09ccec20b0b2c19c5f311ff8926cec9b Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Wed, 30 Oct 2024 20:18:45 +0530 Subject: [PATCH 4/8] Simplified the test case. --- ...houldNotOccurWhenIsClippedToBoundsIsTrue.png | Bin 8613 -> 0 bytes .../Tests/Issues/Issue18937.cs | 4 ++-- ...houldNotOccurWhenIsClippedToBoundsIsTrue.png | Bin 18196 -> 0 bytes 3 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png delete mode 100644 src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue.png deleted file mode 100644 index b619c4850a2f3fa685a79c0aefc7cc09a933bc7d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8613 zcmeI2c~p~ky2l@@6%_~?B!CtzwNm_+}qKmJ7hS z3jiy|qjRqS&Uym8ISLR^4q!*9dhj(CVAbFD@BMDKgIB1*VA#KZzwt?HYik36VA!$4 z05Aqn3(y202Uq}D2ABol1N;IY0GI>lHF^cO3?Kz~4Il;>2518q1Xu)+0Q3VO#;5=q z0Anf~fChkT03v`1fJ^`y01sdYpbtO^pab}C0AqqB01ANX08D^80J#7c0rUV%0BV3A z0rCOn0UiO|0=NS30N_4AH2@u83g9KcT>xXzEPxvT6#!KLKLI=emd}J5TFQv4R8;j1)vb15+DPB4Deq76eCptEkFT49>8A!ngRX>kPXlZ&<*fc zfDV8c0Hpw<09OIV0Y(5G0^A130gwUI1N;oo1E2z^0U!Y|0Ez)R0m=Z*1GEEl0n7kA zH#QF7F+d$a5T`&4#)cjHDs!#nQAjKM5*&%WJeuQs4Ix_-QDlVxP)IJRfk&hIkD zW+yb2M~=rlOis9SYS*80g|=JwtXp@<#eRR}YWp?p-6ub&-*D*N4Lc9rfBAm>{si~t z`W8bfucBwJf9^zuN5a|_ERAO+otFB`{QbixWxZAO`G(?E#yS<*s1H|0xP~Xq@)^mDyKVmO|CN_1r@_FW7Q*%ta4rblX53HfQ4OaCOCmR&W7NFf?S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: [PATCH 5/8] Removed platform condition. --- .../tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs index a6970f67ea57..fb7b4df09a4a 100644 --- a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue18937.cs @@ -1,5 +1,4 @@ -#if !MACCATALYST -using NUnit.Framework; +using NUnit.Framework; using UITest.Appium; using UITest.Core; @@ -19,5 +18,4 @@ public void ExceptionShouldNotOccurWhenIsClippedToBoundsIsTrue() Assert.That(testLabel.GetText(), Is.EqualTo("Label Inside the Border")); } } -} -#endif \ No newline at end of file +} \ No newline at end of file From 943c08514437dc102ff3059bb0b317df35fcba08 Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Fri, 8 Nov 2024 12:32:34 +0530 Subject: [PATCH 6/8] Changed return type. --- src/Core/src/Platform/Windows/ContentPanel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Core/src/Platform/Windows/ContentPanel.cs b/src/Core/src/Platform/Windows/ContentPanel.cs index 223ec4a19e92..566269b95ff0 100644 --- a/src/Core/src/Platform/Windows/ContentPanel.cs +++ b/src/Core/src/Platform/Windows/ContentPanel.cs @@ -61,7 +61,7 @@ internal FrameworkElement? Content var size = new global::Windows.Foundation.Size(Math.Max(0, actual.Width), Math.Max(0, actual.Height)); // We need to update the clip since the content's position might have changed - UpdateClip(_borderStroke?.Shape, size.Width, size.Height); + _ = UpdateClipAsync(_borderStroke?.Shape, size.Width, size.Height); return size; } @@ -90,7 +90,7 @@ void ContentPanelSizeChanged(object sender, SizeChangedEventArgs e) } _borderPath.UpdatePath(_borderStroke?.Shape, width, height); - UpdateClip(_borderStroke?.Shape, width, height); + _ = UpdateClipAsync(_borderStroke?.Shape, width, height); } internal void EnsureBorderPath(bool containsCheck = true) @@ -160,10 +160,10 @@ void UpdateBorder(IShape? strokeShape) return; } - UpdateClip(strokeShape, width, height); + _ = UpdateClipAsync(strokeShape, width, height); } - async void UpdateClip(IShape? borderShape, double width, double height) + async Task UpdateClipAsync(IShape? borderShape, double width, double height) { if (Content is null) { From 82eaee9296bce9a094b67be5c749e40202412475 Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Tue, 26 Nov 2024 19:19:17 +0530 Subject: [PATCH 7/8] ContentPanel changes. --- src/Core/src/Platform/Windows/ContentPanel.cs | 16 +++++----------- src/Core/src/Platform/Windows/LayoutPanel.cs | 5 ++++- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/Core/src/Platform/Windows/ContentPanel.cs b/src/Core/src/Platform/Windows/ContentPanel.cs index 566269b95ff0..65be103a7a1b 100644 --- a/src/Core/src/Platform/Windows/ContentPanel.cs +++ b/src/Core/src/Platform/Windows/ContentPanel.cs @@ -1,6 +1,5 @@ using System; using System.Numerics; -using System.Threading.Tasks; using Microsoft.Graphics.Canvas; using Microsoft.Maui.Graphics; #if MAUI_GRAPHICS_WIN2D @@ -22,7 +21,7 @@ public class ContentPanel : MauiPanel FrameworkElement? _content; internal Path? BorderPath => _borderPath; - + internal IBorderStroke? BorderStroke => _borderStroke; internal FrameworkElement? Content { get => _content; @@ -61,7 +60,7 @@ internal FrameworkElement? Content var size = new global::Windows.Foundation.Size(Math.Max(0, actual.Width), Math.Max(0, actual.Height)); // We need to update the clip since the content's position might have changed - _ = UpdateClipAsync(_borderStroke?.Shape, size.Width, size.Height); + UpdateClip(_borderStroke?.Shape, size.Width, size.Height); return size; } @@ -90,7 +89,7 @@ void ContentPanelSizeChanged(object sender, SizeChangedEventArgs e) } _borderPath.UpdatePath(_borderStroke?.Shape, width, height); - _ = UpdateClipAsync(_borderStroke?.Shape, width, height); + UpdateClip(_borderStroke?.Shape, width, height); } internal void EnsureBorderPath(bool containsCheck = true) @@ -160,10 +159,10 @@ void UpdateBorder(IShape? strokeShape) return; } - _ = UpdateClipAsync(strokeShape, width, height); + UpdateClip(strokeShape, width, height); } - async Task UpdateClipAsync(IShape? borderShape, double width, double height) + void UpdateClip(IShape? borderShape, double width, double height) { if (Content is null) { @@ -184,11 +183,6 @@ async Task UpdateClipAsync(IShape? borderShape, double width, double height) var visual = ElementCompositionPreview.GetElementVisual(Content); - visual.Clip = null; - - //Adding Task.Yield ensures that all layouts are properly updated before applying the clip. - await Task.Yield(); - var compositor = visual.Compositor; PathF? clipPath; diff --git a/src/Core/src/Platform/Windows/LayoutPanel.cs b/src/Core/src/Platform/Windows/LayoutPanel.cs index 3c375a3caa97..05089e95a42f 100644 --- a/src/Core/src/Platform/Windows/LayoutPanel.cs +++ b/src/Core/src/Platform/Windows/LayoutPanel.cs @@ -19,7 +19,10 @@ protected override WSize ArrangeOverride(WSize finalSize) { var actual = base.ArrangeOverride(finalSize); - Clip = ClipsToBounds ? new RectangleGeometry { Rect = new WRect(0, 0, finalSize.Width, finalSize.Height) } : null; + if (!(Parent is ContentPanel contentPanel && contentPanel.BorderStroke?.Shape is not null)) + { + Clip = ClipsToBounds ? new RectangleGeometry { Rect = new WRect(0, 0, finalSize.Width, finalSize.Height) } : null; + } return actual; } From 07b2ef651b0b1d692e7e44c3884e3f36992ce4cb Mon Sep 17 00:00:00 2001 From: Tamilarasan Paranthaman Date: Tue, 26 Nov 2024 19:21:07 +0530 Subject: [PATCH 8/8] Revert unwanted changes --- src/Core/src/Platform/Windows/ContentPanel.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Core/src/Platform/Windows/ContentPanel.cs b/src/Core/src/Platform/Windows/ContentPanel.cs index 65be103a7a1b..b1f23231c780 100644 --- a/src/Core/src/Platform/Windows/ContentPanel.cs +++ b/src/Core/src/Platform/Windows/ContentPanel.cs @@ -182,7 +182,6 @@ void UpdateClip(IShape? borderShape, double width, double height) } var visual = ElementCompositionPreview.GetElementVisual(Content); - var compositor = visual.Compositor; PathF? clipPath;