From 5a92c4490135d7e7a51262b345074a049f4583a0 Mon Sep 17 00:00:00 2001 From: h3xds1nz Date: Tue, 1 Apr 2025 16:45:41 +0200 Subject: [PATCH] Avoid obsoletion warning suppression in ActiveXHost --- .../System/Windows/Interop/ActiveXHost.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/ActiveXHost.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/ActiveXHost.cs index 12eb13ff9d8..5a0f6c97d76 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/ActiveXHost.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/ActiveXHost.cs @@ -79,14 +79,11 @@ static ActiveXHost() /// constructor for ActiveXHost internal ActiveXHost(Guid clsid, bool fTrusted ) : base( fTrusted ) { - // Thread.ApartmentState is [Obsolete] - #pragma warning disable 0618 // What if the control is marked as free-threaded? - if (Thread.CurrentThread.ApartmentState != ApartmentState.STA) + if (Thread.CurrentThread.GetApartmentState() is not ApartmentState.STA) { throw new ThreadStateException(SR.Format(SR.AxRequiresApartmentThread, clsid.ToString())); } - #pragma warning restore 0618 _clsid = clsid;