From 1bed4d01a98616195d0713fd1ddc5a13cab61e55 Mon Sep 17 00:00:00 2001 From: Jeremy Kuhne Date: Mon, 19 Apr 2021 15:55:12 -0700 Subject: [PATCH] Merge pull request #4811 (#4812) Disable SYSLIB0016 warning --- .../src/System/Windows/Forms/DeviceContextHdcScope.cs | 2 ++ .../src/System/Windows/Forms/Internal/DrawingEventArgs.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextHdcScope.cs b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextHdcScope.cs index d5d95a10521..cbac0de403c 100644 --- a/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextHdcScope.cs +++ b/src/System.Windows.Forms.Primitives/src/System/Windows/Forms/DeviceContextHdcScope.cs @@ -146,8 +146,10 @@ public unsafe DeviceContextHdcScope( bool applyTransform = applyGraphicsState.HasFlag(ApplyGraphicsProperties.TranslateTransform); bool applyClipping = applyGraphicsState.HasFlag(ApplyGraphicsProperties.Clipping); +#pragma warning disable SYSLIB0016 // Type or member is obsolete // This API is very expensive and cannot be called after GetHdc() object[]? data = applyTransform || applyClipping ? (object[])graphics.GetContextInfo() : null; +#pragma warning restore SYSLIB0016 // Type or member is obsolete using Region? clipRegion = (Region?)data?[0]; using Matrix? worldTransform = (Matrix?)data?[1]; diff --git a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/DrawingEventArgs.cs b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/DrawingEventArgs.cs index fe1868bf8a6..779b6e5b3d1 100644 --- a/src/System.Windows.Forms/src/System/Windows/Forms/Internal/DrawingEventArgs.cs +++ b/src/System.Windows.Forms/src/System/Windows/Forms/Internal/DrawingEventArgs.cs @@ -156,8 +156,10 @@ internal static void CheckGraphicsForState(Graphics? graphics, DrawingEventFlags return; } +#pragma warning disable SYSLIB0016 // Type or member is obsolete // Check to see if we've actually corrupted the state object[] data = (object[])graphics.GetContextInfo(); +#pragma warning restore SYSLIB0016 // Type or member is obsolete using Region clipRegion = (Region)data[0]; using Matrix worldTransform = (Matrix)data[1];