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;