Skip to content

Commit 7981e6b

Browse files
authored
Avoid obsoletion warning suppression in ActiveXHost (#10689)
1 parent c80941d commit 7981e6b

File tree

1 file changed

+1
-4
lines changed
  • src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop

1 file changed

+1
-4
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Interop/ActiveXHost.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ static ActiveXHost()
7979
/// constructor for ActiveXHost
8080
internal ActiveXHost(Guid clsid, bool fTrusted ) : base( fTrusted )
8181
{
82-
// Thread.ApartmentState is [Obsolete]
83-
#pragma warning disable 0618
8482
// What if the control is marked as free-threaded?
85-
if (Thread.CurrentThread.ApartmentState != ApartmentState.STA)
83+
if (Thread.CurrentThread.GetApartmentState() is not ApartmentState.STA)
8684
{
8785
throw new ThreadStateException(SR.Format(SR.AxRequiresApartmentThread, clsid.ToString()));
8886
}
89-
#pragma warning restore 0618
9087

9188
_clsid = clsid;
9289

0 commit comments

Comments
 (0)