diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp index 9c9ebaddfef..f96c34564fa 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.cpp @@ -92,9 +92,6 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface _pFactory = (IDWriteFactory*)factoryTemp; } - #pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] - #pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported. __declspec(noinline) bool Factory::ReleaseHandle() { if (_wpfFontCollectionLoader != nullptr) diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.h index d9b5ec75de1..894c1e9278f 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.h +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/Factory.h @@ -79,9 +79,6 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface protected: - #pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] - #pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported. virtual bool ReleaseHandle() override; internal: diff --git a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/NativePointerWrapper.h b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/NativePointerWrapper.h index 82fa59255c6..a1dafcd6ad4 100644 --- a/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/NativePointerWrapper.h +++ b/src/Microsoft.DotNet.Wpf/src/DirectWriteForwarder/CPP/DWriteWrapper/NativePointerWrapper.h @@ -19,10 +19,7 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n NativePointerCriticalHandle(void* pNativePointer); virtual property bool IsInvalid - { - #pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] - #pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported. + { bool get() override; } diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsTablet.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsTablet.cs index 95c47a36cc0..ecd3d791eff 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsTablet.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsTablet.cs @@ -84,19 +84,13 @@ private RecognizerSafeHandle(bool ownHandle) // Do not provide a finalizer - SafeHandle's critical finalizer will // call ReleaseHandle for you. public override bool IsInvalid - { - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + { get { return IsClosed || handle == IntPtr.Zero; } } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. override protected bool ReleaseHandle() { Debug.Assert(handle != IntPtr.Zero); @@ -126,19 +120,12 @@ private ContextSafeHandle(bool ownHandle) // call ReleaseHandle for you. public override bool IsInvalid { - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. get { return IsClosed || handle == IntPtr.Zero; } } - - - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + override protected bool ReleaseHandle() { //Note: It is not an error to have already called DestroyRecognizer diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/UnsafeNativeMethodsMilCoreApi.cs b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/UnsafeNativeMethodsMilCoreApi.cs index d196d31092f..28a50c5becb 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/UnsafeNativeMethodsMilCoreApi.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/UnsafeNativeMethodsMilCoreApi.cs @@ -524,9 +524,7 @@ internal static class MILUnknown [DllImport(DllImport.MilCore, EntryPoint = "MILAddRef")] internal static extern UInt32 AddRef(SafeReversePInvokeWrapper pIUnknown); - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [DllImport(DllImport.MilCore, EntryPoint = "MILRelease"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + [DllImport(DllImport.MilCore, EntryPoint = "MILRelease")] internal static extern int Release(IntPtr pIUnkown); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/AssemblyFilter.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/AssemblyFilter.cs index 4c8d9bd76f3..2488be41b25 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/AssemblyFilter.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/AssemblyFilter.cs @@ -37,40 +37,7 @@ static AssemblyFilter() internal void FilterCallback(Object sender, AssemblyLoadEventArgs args) { - // This code is reentrant - lock (_lock) - { - // Extract assembly - Assembly a = args.LoadedAssembly; - // xmlns cache loads assemblies as reflection only and we cannot inspect these using the code below - // so we ignore also keeping this first is super important because the first time cost is really high - // other wise also we cannot do any processing on a reflection only assembly aside from reflection based actions - if (!a.ReflectionOnly) - { - // check if it is in the Gac , this ensures that we eliminate any non GAC assembly which are of no risk - #pragma warning disable SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete. - if (a.GlobalAssemblyCache) - #pragma warning restore SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete. - { - string assemblyName = AssemblyNameWithFileVersion(a); - // If we are on the disallowed list kill the application domain - if (AssemblyOnDisallowedList(assemblyName)) - { - // Kill the application domain - UnsafeNativeMethods.ProcessUnhandledException_DLL(SR.Get(SRID.KillBitEnforcedShutdown) + assemblyName); - // I want to ensure that the process really dies - try - { - System.Environment.Exit(-1); - } - finally - { - Debug.Fail("Environment.Exit() failed."); - } - } - } - } - } + /* This method no longer applies to .NET Core and should be removed. */ } //appends assembly name with file version to generate a unique entry for the assembly lookup process diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ResourceContainer.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ResourceContainer.cs index 7c461f5a695..3e418a4db39 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ResourceContainer.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/ResourceContainer.cs @@ -252,9 +252,7 @@ private void OnAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs arg // We do not care about assemblies loaded into the reflection-only context or the Gaced assemblies. // For example, in Sparkle whenever a project is built all dependent assemblies will be loaded reflection only. // We do no care about those. Only when a assembly is loaded into the execution context, we will need to update the cache. - #pragma warning disable SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete. - if ((!assembly.ReflectionOnly) && (!assembly.GlobalAssemblyCache)) - #pragma warning restore SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete. + if ((!assembly.ReflectionOnly)) { AssemblyName assemblyInfo = new AssemblyName(assembly.FullName); diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs index d5641775089..f14626a30f3 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Markup/XamlTypeMapper.cs @@ -229,9 +229,11 @@ public void SetAssemblyPath( // so they can be loaded again. The is the Dev build/load/build/load // Designer scenario. (Don't mess with GACed assemblies) Assembly assem = ReflectionHelper.GetAlreadyLoadedAssembly(asmName); - #pragma warning disable SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete. - if (assem != null && !assem.GlobalAssemblyCache) - #pragma warning restore SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete. + if (assem != null +#if NETFX + && !assem.GlobalAssemblyCache +#endif + ) { ReflectionHelper.ResetCacheForAssembly(asmName); // No way to reset SchemaContext at assembly granularity, so just reset the whole context diff --git a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/NativeMethods.cs b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/NativeMethods.cs index 31d01e805db..84feae559ea 100644 --- a/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/NativeMethods.cs +++ b/src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Standard/NativeMethods.cs @@ -1389,9 +1389,6 @@ public IntPtr Hwnd private SafeDC() : base(true) { } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. protected override bool ReleaseHandle() { if (_created) @@ -1514,9 +1511,6 @@ internal sealed class SafeHBITMAP : SafeHandleZeroOrMinusOneIsInvalid { private SafeHBITMAP() : base(true) { } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. protected override bool ReleaseHandle() { return NativeMethods.DeleteObject(handle); @@ -1527,9 +1521,6 @@ internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvali { private SafeGdiplusStartupToken() : base(true) { } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. protected override bool ReleaseHandle() { Status s = NativeMethods.GdiplusShutdown(this.handle); @@ -1598,9 +1589,7 @@ public void Disconnect() } [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + protected override bool ReleaseHandle() { try @@ -2665,9 +2654,7 @@ public static void DrawMenuBar(IntPtr hWnd) [SuppressMessage("Mricrosoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [DllImport("kernel32.dll")] - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + [return: MarshalAs(UnmanagedType.Bool)] public static extern bool FindClose(IntPtr handle); diff --git a/src/Microsoft.DotNet.Wpf/src/ReachFramework/MS/Internal/Printing/Configuration/UnsafeNativeMethods.cs b/src/Microsoft.DotNet.Wpf/src/ReachFramework/MS/Internal/Printing/Configuration/UnsafeNativeMethods.cs index b8e093eba61..9f41573ecb0 100644 --- a/src/Microsoft.DotNet.Wpf/src/ReachFramework/MS/Internal/Printing/Configuration/UnsafeNativeMethods.cs +++ b/src/Microsoft.DotNet.Wpf/src/ReachFramework/MS/Internal/Printing/Configuration/UnsafeNativeMethods.cs @@ -75,9 +75,7 @@ public static uint PTOpenProviderEx( /// device handle proxy has been bound to /// HRESULT code [DllImport(DllImport.PrntvPt, EntryPoint = "PTCloseProvider", CharSet = CharSet.Unicode, ExactSpelling = true)] - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + public static extern uint PTCloseProviderImpl(IntPtr handle); /// diff --git a/src/Microsoft.DotNet.Wpf/src/ReachFramework/PrintConfig/FallbackPTProvider.cs b/src/Microsoft.DotNet.Wpf/src/ReachFramework/PrintConfig/FallbackPTProvider.cs index 64c339957b8..a905a7ac938 100644 --- a/src/Microsoft.DotNet.Wpf/src/ReachFramework/PrintConfig/FallbackPTProvider.cs +++ b/src/Microsoft.DotNet.Wpf/src/ReachFramework/PrintConfig/FallbackPTProvider.cs @@ -399,9 +399,7 @@ private string OemDriverNamespace CultureInfo.InvariantCulture, DeviceNamespaceFormat, BuildInfo.WCP_VERSION_SUFFIX, - #pragma warning disable SYSLIB0013 - Uri.EscapeUriString(this._driverName), - #pragma warning restore SYSLIB0013 + Uri.EscapeDataString(this._driverName), this._driverVersion); } diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/ReaderWriterLockWrapper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/ReaderWriterLockWrapper.cs index 12ab606cdce..52c4b02b924 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/ReaderWriterLockWrapper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/ReaderWriterLockWrapper.cs @@ -299,9 +299,7 @@ public NonPumpingSynchronizationContext() /// /// Wait for a set of handles. /// - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [PrePrepareMethod] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) { return MS.Win32.UnsafeNativeMethods.WaitForMultipleObjectsEx(waitHandles.Length, waitHandles, waitAll, millisecondsTimeout, false); diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/NativeMethodsOther.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/NativeMethodsOther.cs index 3c759380175..3c0f89d645a 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/NativeMethodsOther.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/NativeMethodsOther.cs @@ -258,9 +258,7 @@ private BitmapHandle() : this(true) private BitmapHandle(bool ownsHandle) : base(ownsHandle, NativeMethods.CommonHandles.GDI) { } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + protected override bool ReleaseHandle() { return UnsafeNativeMethods.DeleteObject(handle); @@ -285,10 +283,7 @@ internal sealed class IconHandle : WpfSafeHandle private IconHandle() : base(true, NativeMethods.CommonHandles.Icon) { } - - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + protected override bool ReleaseHandle() { return UnsafeNativeMethods.DestroyIcon(handle); @@ -314,9 +309,6 @@ private CursorHandle() : base(true, NativeMethods.CommonHandles.Cursor) { } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. protected override bool ReleaseHandle() { return UnsafeNativeMethods.DestroyCursor( handle ); @@ -594,9 +586,6 @@ protected override bool ReleaseHandle() return (LocalFree(base.handle) == IntPtr.Zero); } - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. [DllImport("kernel32.dll")] private static extern IntPtr LocalFree(IntPtr hMem); } diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsOther.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsOther.cs index c27420492a0..5f0d758f925 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsOther.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Win32/UnsafeNativeMethodsOther.cs @@ -170,9 +170,7 @@ unsafe void QueryCustomPolicy( /// /// /// - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [DllImport(ExternDll.Kernel32, SetLastError = true), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + [DllImport(ExternDll.Kernel32, SetLastError = true)] internal static extern IntPtr LocalFree(IntPtr hMem); #if BASE_NATIVEMETHODS @@ -638,9 +636,7 @@ internal static void SetWindowText(HandleRef hWnd, string text) } } [DllImport(ExternDll.User32, EntryPoint = "GetIconInfo", CharSet = CharSet.Auto, SetLastError = true)] - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + private static extern bool GetIconInfoImpl(HandleRef hIcon, [Out] ICONINFO_IMPL piconinfo); [StructLayout(LayoutKind.Sequential)] @@ -664,9 +660,6 @@ internal static void GetIconInfo(HandleRef hIcon, out NativeMethods.ICONINFO pic piconinfo = new NativeMethods.ICONINFO(); ICONINFO_IMPL iconInfoImpl = new ICONINFO_IMPL(); - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - SRCS.RuntimeHelpers.PrepareConstrainedRegions(); // Mark the following as special - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. try { // Intentionally empty diff --git a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/inc/GDIExporter/precomp.hpp b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/inc/GDIExporter/precomp.hpp index 7c9e5da8c29..e1705bbb7e7 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/inc/GDIExporter/precomp.hpp +++ b/src/Microsoft.DotNet.Wpf/src/System.Printing/CPP/inc/GDIExporter/precomp.hpp @@ -2,9 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// Turn off CER warnings: The Constrained Execution Region (CER) feature is not supported. -#pragma warning (disable : 4950) - #ifndef GDIEXPORTER #define GDIEXPORTER @@ -101,12 +98,10 @@ ref class GdiSafeHandle : public InteropServices::SafeHandle property bool IsInvalid { - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] bool virtual get() override { return IsClosed || (handle == IntPtr::Zero); } } protected: - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] bool virtual ReleaseHandle() override { IntPtr tempHandle = handle; @@ -140,7 +135,6 @@ ref class GdiSafeDCHandle : public GdiSafeHandle #endif protected: - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] bool virtual ReleaseHandle() override { IntPtr tempHandle = handle; @@ -168,7 +162,6 @@ ref class GdiFontResourceSafeHandle : public System::Runtime::InteropServices::S property bool IsInvalid { - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] bool virtual get() override { return IsClosed || (handle == IntPtr::Zero); } } @@ -181,7 +174,6 @@ ref class GdiFontResourceSafeHandle : public System::Runtime::InteropServices::S } protected: - [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] bool virtual ReleaseHandle() override { IntPtr tempHandle = handle; diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Misc.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Misc.cs index 05079beeb4e..f15e0bad80b 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Misc.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/MS/Internal/Automation/Misc.cs @@ -503,9 +503,6 @@ internal static int TryMsgWaitForMultipleObjects(SafeWaitHandle handle, bool wai } else { - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - RuntimeHelpers.PrepareConstrainedRegions(); - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. bool fRelease = false; try { diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/Condition.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/Condition.cs index 7c556809233..0c39c90b592 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/Condition.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClient/System/Windows/Automation/Condition.cs @@ -44,9 +44,6 @@ internal static SafeConditionMemoryHandle AllocateConditionHandle(object uiaCond SafeConditionMemoryHandle sh = new SafeConditionMemoryHandle(); int size = Marshal.SizeOf(uiaCondition); - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - RuntimeHelpers.PrepareConstrainedRegions(); // ensures that the following finally block is atomic - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. try { } finally { @@ -66,9 +63,6 @@ internal static SafeConditionMemoryHandle AllocateConditionArrayHandle(Condition int intPtrSize = Marshal.SizeOf(typeof(IntPtr)); - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - RuntimeHelpers.PrepareConstrainedRegions(); // ensures that the following finally block is atomic - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. try { } finally { diff --git a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs index e4bb2cdbae3..be975199879 100644 --- a/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs +++ b/src/Microsoft.DotNet.Wpf/src/UIAutomation/UIAutomationClientSideProviders/MS/Internal/AutomationProxies/Misc.cs @@ -995,9 +995,6 @@ internal static int MsgWaitForMultipleObjects(SafeWaitHandle handle, bool waitAl } else { - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - RuntimeHelpers.PrepareConstrainedRegions(); - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. bool fRelease = false; try { diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherSynchronizationContext.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherSynchronizationContext.cs index 919666edcba..87f8dc45051 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherSynchronizationContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/System/Windows/Threading/DispatcherSynchronizationContext.cs @@ -89,9 +89,6 @@ public override void Post(SendOrPostCallback d, Object state) /// /// Wait for a set of handles. /// - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [PrePrepareMethod] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) { if(_dispatcher._disableProcessingCount > 0) diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsFormsIntegration/MS/Win32/UnsafeNativeMethods.cs b/src/Microsoft.DotNet.Wpf/src/WindowsFormsIntegration/MS/Win32/UnsafeNativeMethods.cs index 4ae49489651..e019bca180d 100644 --- a/src/Microsoft.DotNet.Wpf/src/WindowsFormsIntegration/MS/Win32/UnsafeNativeMethods.cs +++ b/src/Microsoft.DotNet.Wpf/src/WindowsFormsIntegration/MS/Win32/UnsafeNativeMethods.cs @@ -52,9 +52,7 @@ public static DCSafeHandle CreateDC(string lpszDriver) } [DllImport(ExternDll.Gdi32, ExactSpelling = true, CharSet = CharSet.Auto)] - #pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. - [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] - #pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported. + [ResourceExposure(ResourceScope.None)] public static extern bool DeleteDC(IntPtr hDC); }