From dce7d2a56833efaa645cd7f1f16d7d1948c76191 Mon Sep 17 00:00:00 2001 From: Tian L <60599517+tian-lt@users.noreply.github.com> Date: Mon, 24 May 2021 15:10:23 +0800 Subject: [PATCH] Remove the finalizer of ControlSizeTrigger (#31) --- .../Views/StateTriggers/ControlSizeTrigger.cs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Calculator/Views/StateTriggers/ControlSizeTrigger.cs b/src/Calculator/Views/StateTriggers/ControlSizeTrigger.cs index 505a4d22..0b3fc452 100644 --- a/src/Calculator/Views/StateTriggers/ControlSizeTrigger.cs +++ b/src/Calculator/Views/StateTriggers/ControlSizeTrigger.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using System; @@ -49,21 +49,6 @@ namespace CalculatorApp.Views.StateTriggers public static readonly DependencyProperty MinWidthProperty = DependencyProperty.Register(nameof(MinWidth), typeof(double), typeof(ControlSizeTrigger), new PropertyMetadata(-1)); - ~ControlSizeTrigger() - { - // CSHARP_MIGRATION: TODO: - // finalization will happen on a finalizer's thread. - // to prevent crashing the entire app, switch to UI thread to do unregistering work - Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => - { - UnregisterSizeChanged(Source); - }) - .AsTask() - .ConfigureAwait(false) - .GetAwaiter() - .GetResult(); - } - private void OnSourcePropertyChanged(FrameworkElement oldValue, FrameworkElement newValue) { UnregisterSizeChanged(oldValue);