提交 dc7669ed 编写于 作者: R Ryland Alaniz

Fix break from moving to new Cpp toolset: Constrained Execution Region...

Fix break from moving to new Cpp toolset: Constrained Execution Region feature, Assembly.GlobalAssemblyCache, BinaryFormatter, etc.
上级 a57b4fa8
...@@ -92,7 +92,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface ...@@ -92,7 +92,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
_pFactory = (IDWriteFactory*)factoryTemp; _pFactory = (IDWriteFactory*)factoryTemp;
} }
#pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)]
#pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported.
__declspec(noinline) bool Factory::ReleaseHandle() __declspec(noinline) bool Factory::ReleaseHandle()
{ {
if (_wpfFontCollectionLoader != nullptr) if (_wpfFontCollectionLoader != nullptr)
......
...@@ -79,7 +79,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface ...@@ -79,7 +79,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
protected: protected:
#pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)]
#pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported.
virtual bool ReleaseHandle() override; virtual bool ReleaseHandle() override;
internal: internal:
...@@ -221,7 +223,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface ...@@ -221,7 +223,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface
virtual property bool IsInvalid virtual property bool IsInvalid
{ {
#pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)]
#pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported.
bool get() override; bool get() override;
} }
}; };
......
...@@ -20,7 +20,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n ...@@ -20,7 +20,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n
virtual property bool IsInvalid virtual property bool IsInvalid
{ {
#pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)]
#pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported.
bool get() override; bool get() override;
} }
...@@ -35,7 +37,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n ...@@ -35,7 +37,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n
{ {
protected: protected:
#pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)]
#pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported.
virtual bool ReleaseHandle() override; virtual bool ReleaseHandle() override;
public: public:
...@@ -47,7 +51,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n ...@@ -47,7 +51,9 @@ namespace MS { namespace Internal { namespace Text { namespace TextInterface { n
{ {
protected: protected:
#pragma warning (disable : 4950) // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)] [ReliabilityContract(Consistency::WillNotCorruptState, Cer::Success)]
#pragma warning (default : 4950) // The Constrained Execution Region (CER) feature is not supported.
virtual bool ReleaseHandle() override; virtual bool ReleaseHandle() override;
public: public:
......
...@@ -85,14 +85,18 @@ private RecognizerSafeHandle(bool ownHandle) ...@@ -85,14 +85,18 @@ private RecognizerSafeHandle(bool ownHandle)
// call ReleaseHandle for you. // call ReleaseHandle for you.
public override bool IsInvalid public override bool IsInvalid
{ {
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
get get
{ {
return IsClosed || handle == IntPtr.Zero; return IsClosed || handle == IntPtr.Zero;
} }
} }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
override protected bool ReleaseHandle() override protected bool ReleaseHandle()
{ {
Debug.Assert(handle != IntPtr.Zero); Debug.Assert(handle != IntPtr.Zero);
...@@ -122,7 +126,9 @@ private ContextSafeHandle(bool ownHandle) ...@@ -122,7 +126,9 @@ private ContextSafeHandle(bool ownHandle)
// call ReleaseHandle for you. // call ReleaseHandle for you.
public override bool IsInvalid public override bool IsInvalid
{ {
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
get get
{ {
return IsClosed || handle == IntPtr.Zero; return IsClosed || handle == IntPtr.Zero;
...@@ -130,7 +136,9 @@ public override bool IsInvalid ...@@ -130,7 +136,9 @@ public override bool IsInvalid
} }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
override protected bool ReleaseHandle() override protected bool ReleaseHandle()
{ {
//Note: It is not an error to have already called DestroyRecognizer //Note: It is not an error to have already called DestroyRecognizer
......
...@@ -524,7 +524,10 @@ internal static class MILUnknown ...@@ -524,7 +524,10 @@ internal static class MILUnknown
[DllImport(DllImport.MilCore, EntryPoint = "MILAddRef")] [DllImport(DllImport.MilCore, EntryPoint = "MILAddRef")]
internal static extern UInt32 AddRef(SafeReversePInvokeWrapper pIUnknown); 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)] [DllImport(DllImport.MilCore, EntryPoint = "MILRelease"), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
internal static extern int Release(IntPtr pIUnkown); internal static extern int Release(IntPtr pIUnkown);
internal static void ReleaseInterface(ref IntPtr ptr) internal static void ReleaseInterface(ref IntPtr ptr)
......
...@@ -1768,7 +1768,9 @@ private int SaveObjectToHandle(IntPtr handle, Object data, bool doNotReallocate) ...@@ -1768,7 +1768,9 @@ private int SaveObjectToHandle(IntPtr handle, Object data, bool doNotReallocate)
formatter = new BinaryFormatter(); formatter = new BinaryFormatter();
#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete
formatter.Serialize(stream, data); formatter.Serialize(stream, data);
#pragma warning restore SYSLIB0011 // BinaryFormatter is obsolete
return SaveStreamToHandle(handle, stream, doNotReallocate); return SaveStreamToHandle(handle, stream, doNotReallocate);
} }
} }
...@@ -3122,7 +3124,9 @@ private Object ReadObjectFromHandle(IntPtr handle, bool restrictDeserialization) ...@@ -3122,7 +3124,9 @@ private Object ReadObjectFromHandle(IntPtr handle, bool restrictDeserialization)
} }
try try
{ {
#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete
value = formatter.Deserialize(stream); value = formatter.Deserialize(stream);
#pragma warning restore SYSLIB0011 // BinaryFormatter is obsolete
} }
catch (RestrictedTypeDeserializationException) catch (RestrictedTypeDeserializationException)
{ {
......
...@@ -48,7 +48,9 @@ internal void FilterCallback(Object sender, AssemblyLoadEventArgs args) ...@@ -48,7 +48,9 @@ internal void FilterCallback(Object sender, AssemblyLoadEventArgs args)
if (!a.ReflectionOnly) if (!a.ReflectionOnly)
{ {
// check if it is in the Gac , this ensures that we eliminate any non GAC assembly which are of no risk // 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) if (a.GlobalAssemblyCache)
#pragma warning restore SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete.
{ {
string assemblyName = AssemblyNameWithFileVersion(a); string assemblyName = AssemblyNameWithFileVersion(a);
// If we are on the disallowed list kill the application domain // If we are on the disallowed list kill the application domain
......
...@@ -109,7 +109,9 @@ private Uri GetEntryAssemblyLocation() ...@@ -109,7 +109,9 @@ private Uri GetEntryAssemblyLocation()
try try
{ {
#pragma warning disable // Type or member is obsolete
entryLocation = new Uri(Application.ResourceAssembly.CodeBase); entryLocation = new Uri(Application.ResourceAssembly.CodeBase);
#pragma warning restore // Type or member is obsolete
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -252,7 +252,9 @@ private void OnAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs arg ...@@ -252,7 +252,9 @@ private void OnAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs arg
// We do not care about assemblies loaded into the reflection-only context or the Gaced assemblies. // 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. // 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. // 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)) if ((!assembly.ReflectionOnly) && (!assembly.GlobalAssemblyCache))
#pragma warning restore SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete.
{ {
AssemblyName assemblyInfo = new AssemblyName(assembly.FullName); AssemblyName assemblyInfo = new AssemblyName(assembly.FullName);
......
...@@ -126,7 +126,9 @@ private ArrayList SaveSubStreams(UIElement element) ...@@ -126,7 +126,9 @@ private ArrayList SaveSubStreams(UIElement element)
{ {
// Convert the value of the DP into a byte array // Convert the value of the DP into a byte array
MemoryStream byteStream = new MemoryStream(); MemoryStream byteStream = new MemoryStream();
#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete
this.Formatter.Serialize(byteStream, currentValue); this.Formatter.Serialize(byteStream, currentValue);
#pragma warning restore SYSLIB0011 // BinaryFormatter is obsolete
bytes = byteStream.ToArray(); bytes = byteStream.ToArray();
// Dispose the stream // Dispose the stream
...@@ -236,7 +238,9 @@ private void LoadSubStreams(UIElement element, ArrayList subStreams) ...@@ -236,7 +238,9 @@ private void LoadSubStreams(UIElement element, ArrayList subStreams)
object newValue = null; object newValue = null;
if (subStream._data != null) if (subStream._data != null)
{ {
#pragma warning disable SYSLIB0011 // BinaryFormatter is obsolete
newValue = this.Formatter.Deserialize(new MemoryStream(subStream._data)); newValue = this.Formatter.Deserialize(new MemoryStream(subStream._data));
#pragma warning restore SYSLIB0011 // BinaryFormatter is obsolete
} }
element.SetValue(dp, newValue); element.SetValue(dp, newValue);
} }
......
...@@ -291,6 +291,7 @@ public new Type GetType() ...@@ -291,6 +291,7 @@ public new Type GetType()
/// Overridden InitializeLifetimeService method /// Overridden InitializeLifetimeService method
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[ObsoleteAttribute("InitializeLifetimeService is obsolete.", false)]
public override object InitializeLifetimeService() public override object InitializeLifetimeService()
{ {
return _stream.InitializeLifetimeService(); return _stream.InitializeLifetimeService();
......
...@@ -229,7 +229,9 @@ public XamlTypeMapper(string[] assemblyNames) ...@@ -229,7 +229,9 @@ public XamlTypeMapper(string[] assemblyNames)
// so they can be loaded again. The is the Dev build/load/build/load // so they can be loaded again. The is the Dev build/load/build/load
// Designer scenario. (Don't mess with GACed assemblies) // Designer scenario. (Don't mess with GACed assemblies)
Assembly assem = ReflectionHelper.GetAlreadyLoadedAssembly(asmName); Assembly assem = ReflectionHelper.GetAlreadyLoadedAssembly(asmName);
#pragma warning disable SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete.
if (assem != null && !assem.GlobalAssemblyCache) if (assem != null && !assem.GlobalAssemblyCache)
#pragma warning restore SYSLIB0005 // 'Assembly.GlobalAssemblyCache' is obsolete.
{ {
ReflectionHelper.ResetCacheForAssembly(asmName); ReflectionHelper.ResetCacheForAssembly(asmName);
// No way to reset SchemaContext at assembly granularity, so just reset the whole context // No way to reset SchemaContext at assembly granularity, so just reset the whole context
......
...@@ -1389,7 +1389,9 @@ public IntPtr Hwnd ...@@ -1389,7 +1389,9 @@ public IntPtr Hwnd
private SafeDC() : base(true) { } private SafeDC() : base(true) { }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
if (_created) if (_created)
...@@ -1512,7 +1514,9 @@ internal sealed class SafeHBITMAP : SafeHandleZeroOrMinusOneIsInvalid ...@@ -1512,7 +1514,9 @@ internal sealed class SafeHBITMAP : SafeHandleZeroOrMinusOneIsInvalid
{ {
private SafeHBITMAP() : base(true) { } private SafeHBITMAP() : base(true) { }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
return NativeMethods.DeleteObject(handle); return NativeMethods.DeleteObject(handle);
...@@ -1523,7 +1527,9 @@ internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvali ...@@ -1523,7 +1527,9 @@ internal sealed class SafeGdiplusStartupToken : SafeHandleZeroOrMinusOneIsInvali
{ {
private SafeGdiplusStartupToken() : base(true) { } private SafeGdiplusStartupToken() : base(true) { }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
Status s = NativeMethods.GdiplusShutdown(this.handle); Status s = NativeMethods.GdiplusShutdown(this.handle);
...@@ -1592,7 +1598,9 @@ public void Disconnect() ...@@ -1592,7 +1598,9 @@ public void Disconnect()
} }
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
try try
...@@ -2657,7 +2665,9 @@ public static void DrawMenuBar(IntPtr hWnd) ...@@ -2657,7 +2665,9 @@ public static void DrawMenuBar(IntPtr hWnd)
[SuppressMessage("Mricrosoft.Performance", "CA1811:AvoidUncalledPrivateCode")] [SuppressMessage("Mricrosoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[return: MarshalAs(UnmanagedType.Bool)] [return: MarshalAs(UnmanagedType.Bool)]
public static extern bool FindClose(IntPtr handle); public static extern bool FindClose(IntPtr handle);
......
...@@ -76,7 +76,9 @@ internal static class UnsafeNativeMethods ...@@ -76,7 +76,9 @@ internal static class UnsafeNativeMethods
/// <param name="handle">device handle proxy has been bound to</param> /// <param name="handle">device handle proxy has been bound to</param>
/// <returns>HRESULT code</returns> /// <returns>HRESULT code</returns>
[DllImport(DllImport.PrntvPt, EntryPoint = "PTCloseProvider", CharSet = CharSet.Unicode, ExactSpelling = true)] [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)] [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); public static extern uint PTCloseProviderImpl(IntPtr handle);
/// <summary> /// <summary>
......
...@@ -299,7 +299,9 @@ public NonPumpingSynchronizationContext() ...@@ -299,7 +299,9 @@ public NonPumpingSynchronizationContext()
/// <summary> /// <summary>
/// Wait for a set of handles. /// Wait for a set of handles.
/// </summary> /// </summary>
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[PrePrepareMethod] [PrePrepareMethod]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
{ {
return MS.Win32.UnsafeNativeMethods.WaitForMultipleObjectsEx(waitHandles.Length, waitHandles, waitAll, millisecondsTimeout, false); return MS.Win32.UnsafeNativeMethods.WaitForMultipleObjectsEx(waitHandles.Length, waitHandles, waitAll, millisecondsTimeout, false);
......
...@@ -258,7 +258,9 @@ private BitmapHandle() : this(true) ...@@ -258,7 +258,9 @@ private BitmapHandle() : this(true)
private BitmapHandle(bool ownsHandle) : base(ownsHandle, NativeMethods.CommonHandles.GDI) 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)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
return UnsafeNativeMethods.DeleteObject(handle); return UnsafeNativeMethods.DeleteObject(handle);
...@@ -284,7 +286,9 @@ private IconHandle() : base(true, NativeMethods.CommonHandles.Icon) ...@@ -284,7 +286,9 @@ 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)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
return UnsafeNativeMethods.DestroyIcon(handle); return UnsafeNativeMethods.DestroyIcon(handle);
...@@ -310,7 +314,9 @@ private CursorHandle() : base(true, NativeMethods.CommonHandles.Cursor) ...@@ -310,7 +314,9 @@ 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)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
protected override bool ReleaseHandle() protected override bool ReleaseHandle()
{ {
return UnsafeNativeMethods.DestroyCursor( handle ); return UnsafeNativeMethods.DestroyCursor( handle );
...@@ -588,7 +594,9 @@ protected override bool ReleaseHandle() ...@@ -588,7 +594,9 @@ protected override bool ReleaseHandle()
return (LocalFree(base.handle) == IntPtr.Zero); return (LocalFree(base.handle) == IntPtr.Zero);
} }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[DllImport("kernel32.dll")] [DllImport("kernel32.dll")]
private static extern IntPtr LocalFree(IntPtr hMem); private static extern IntPtr LocalFree(IntPtr hMem);
} }
......
...@@ -170,7 +170,9 @@ internal interface IInternetSecurityManager ...@@ -170,7 +170,9 @@ internal interface IInternetSecurityManager
/// </summary> /// </summary>
/// <param name="hMem"></param> /// <param name="hMem"></param>
/// <returns></returns> /// <returns></returns>
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[DllImport(ExternDll.Kernel32, SetLastError = true), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)] [DllImport(ExternDll.Kernel32, SetLastError = true), ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
internal static extern IntPtr LocalFree(IntPtr hMem); internal static extern IntPtr LocalFree(IntPtr hMem);
#if BASE_NATIVEMETHODS #if BASE_NATIVEMETHODS
...@@ -636,7 +638,9 @@ internal static void SetWindowText(HandleRef hWnd, string text) ...@@ -636,7 +638,9 @@ internal static void SetWindowText(HandleRef hWnd, string text)
} }
} }
[DllImport(ExternDll.User32, EntryPoint = "GetIconInfo", CharSet = CharSet.Auto, SetLastError = true)] [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)] [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); private static extern bool GetIconInfoImpl(HandleRef hIcon, [Out] ICONINFO_IMPL piconinfo);
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
...@@ -660,7 +664,9 @@ internal static void GetIconInfo(HandleRef hIcon, out NativeMethods.ICONINFO pic ...@@ -660,7 +664,9 @@ internal static void GetIconInfo(HandleRef hIcon, out NativeMethods.ICONINFO pic
piconinfo = new NativeMethods.ICONINFO(); piconinfo = new NativeMethods.ICONINFO();
ICONINFO_IMPL iconInfoImpl = new ICONINFO_IMPL(); 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 SRCS.RuntimeHelpers.PrepareConstrainedRegions(); // Mark the following as special
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
try try
{ {
// Intentionally empty // Intentionally empty
......
// Licensed to the .NET Foundation under one or more agreements. // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license. // The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. // 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 #ifndef GDIEXPORTER
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
#ifndef __INTEROPPRINTERHANDLER_HPP__ #ifndef __INTEROPPRINTERHANDLER_HPP__
#define __INTEROPPRINTERHANDLER_HPP__ #define __INTEROPPRINTERHANDLER_HPP__
// Turn off CER warnings: The Constrained Execution Region (CER) feature is not supported.
#pragma warning (disable : 4950)
/*++ /*++
Abstract: Abstract:
......
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
[assembly:Dependency("System.Xml,", LoadHint.Sometimes)] [assembly:Dependency("System.Xml,", LoadHint.Sometimes)]
[assembly: TypeForwardedTo(typeof(System.Xaml.Permissions.XamlAccessLevel))] [assembly: TypeForwardedTo(typeof(System.Xaml.Permissions.XamlAccessLevel))]
#pragma warning disable SYSLIB0003 // Type or member is obsolete
[assembly: TypeForwardedTo(typeof(System.Xaml.Permissions.XamlLoadPermission))] [assembly: TypeForwardedTo(typeof(System.Xaml.Permissions.XamlLoadPermission))]
#pragma warning restore SYSLIB0003 // Type or member is obsolete
[assembly: TypeForwardedTo(typeof(System.Windows.Markup.ValueSerializerAttribute))] [assembly: TypeForwardedTo(typeof(System.Windows.Markup.ValueSerializerAttribute))]
[assembly:XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "System.Windows.Markup")] [assembly:XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml", "System.Windows.Markup")]
...@@ -503,7 +503,9 @@ internal static int TryMsgWaitForMultipleObjects(SafeWaitHandle handle, bool wai ...@@ -503,7 +503,9 @@ internal static int TryMsgWaitForMultipleObjects(SafeWaitHandle handle, bool wai
} }
else else
{ {
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
RuntimeHelpers.PrepareConstrainedRegions(); RuntimeHelpers.PrepareConstrainedRegions();
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
bool fRelease = false; bool fRelease = false;
try try
{ {
......
...@@ -44,7 +44,9 @@ internal static SafeConditionMemoryHandle AllocateConditionHandle(object uiaCond ...@@ -44,7 +44,9 @@ internal static SafeConditionMemoryHandle AllocateConditionHandle(object uiaCond
SafeConditionMemoryHandle sh = new SafeConditionMemoryHandle(); SafeConditionMemoryHandle sh = new SafeConditionMemoryHandle();
int size = Marshal.SizeOf(uiaCondition); 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 RuntimeHelpers.PrepareConstrainedRegions(); // ensures that the following finally block is atomic
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
try { } try { }
finally finally
{ {
...@@ -64,7 +66,9 @@ internal static SafeConditionMemoryHandle AllocateConditionArrayHandle(Condition ...@@ -64,7 +66,9 @@ internal static SafeConditionMemoryHandle AllocateConditionArrayHandle(Condition
int intPtrSize = Marshal.SizeOf(typeof(IntPtr)); 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 RuntimeHelpers.PrepareConstrainedRegions(); // ensures that the following finally block is atomic
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
try { } try { }
finally finally
{ {
......
...@@ -995,7 +995,9 @@ internal static int MsgWaitForMultipleObjects(SafeWaitHandle handle, bool waitAl ...@@ -995,7 +995,9 @@ internal static int MsgWaitForMultipleObjects(SafeWaitHandle handle, bool waitAl
} }
else else
{ {
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
RuntimeHelpers.PrepareConstrainedRegions(); RuntimeHelpers.PrepareConstrainedRegions();
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
bool fRelease = false; bool fRelease = false;
try try
{ {
......
...@@ -85,6 +85,7 @@ ...@@ -85,6 +85,7 @@
[assembly:TypeForwardedTo(typeof(System.IO.Packaging.PackageRelationshipSelector))] [assembly:TypeForwardedTo(typeof(System.IO.Packaging.PackageRelationshipSelector))]
[assembly:TypeForwardedTo(typeof(System.IO.Packaging.PackageRelationshipSelectorType))] [assembly:TypeForwardedTo(typeof(System.IO.Packaging.PackageRelationshipSelectorType))]
#pragma warning disable SYSLIB0003 // Type or member is obsolete
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.MediaPermissionAudio))] [assembly: TypeForwardedTo(typeof(System.Security.Permissions.MediaPermissionAudio))]
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.MediaPermissionVideo))] [assembly: TypeForwardedTo(typeof(System.Security.Permissions.MediaPermissionVideo))]
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.MediaPermissionImage))] [assembly: TypeForwardedTo(typeof(System.Security.Permissions.MediaPermissionImage))]
...@@ -93,6 +94,7 @@ ...@@ -93,6 +94,7 @@
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.WebBrowserPermissionLevel))] [assembly: TypeForwardedTo(typeof(System.Security.Permissions.WebBrowserPermissionLevel))]
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.WebBrowserPermission))] [assembly: TypeForwardedTo(typeof(System.Security.Permissions.WebBrowserPermission))]
[assembly: TypeForwardedTo(typeof(System.Security.Permissions.WebBrowserPermissionAttribute))] [assembly: TypeForwardedTo(typeof(System.Security.Permissions.WebBrowserPermissionAttribute))]
#pragma warning restore SYSLIB0003 // Type or member is obsolete
[assembly: TypeForwardedTo(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))] [assembly: TypeForwardedTo(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))]
[assembly: TypeForwardedTo(typeof(System.Collections.ObjectModel.ObservableCollection<>))] [assembly: TypeForwardedTo(typeof(System.Collections.ObjectModel.ObservableCollection<>))]
......
...@@ -89,7 +89,9 @@ public override void Post(SendOrPostCallback d, Object state) ...@@ -89,7 +89,9 @@ public override void Post(SendOrPostCallback d, Object state)
/// <summary> /// <summary>
/// Wait for a set of handles. /// Wait for a set of handles.
/// </summary> /// </summary>
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[PrePrepareMethod] [PrePrepareMethod]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) public override int Wait(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout)
{ {
if(_dispatcher._disableProcessingCount > 0) if(_dispatcher._disableProcessingCount > 0)
......
...@@ -1881,7 +1881,9 @@ public sealed partial class DispatcherSynchronizationContext : System.Threading. ...@@ -1881,7 +1881,9 @@ public sealed partial class DispatcherSynchronizationContext : System.Threading.
public override System.Threading.SynchronizationContext CreateCopy() { throw null; } public override System.Threading.SynchronizationContext CreateCopy() { throw null; }
public override void Post(System.Threading.SendOrPostCallback d, object state) { } public override void Post(System.Threading.SendOrPostCallback d, object state) { }
public override void Send(System.Threading.SendOrPostCallback d, object state) { } public override void Send(System.Threading.SendOrPostCallback d, object state) { }
#pragma warning disable SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[System.Runtime.ConstrainedExecution.PrePrepareMethodAttribute] [System.Runtime.ConstrainedExecution.PrePrepareMethodAttribute]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
public override int Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) { throw null; } public override int Wait(System.IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) { throw null; }
} }
public partial class DispatcherTimer public partial class DispatcherTimer
......
...@@ -52,7 +52,9 @@ public static DCSafeHandle CreateDC(string lpszDriver) ...@@ -52,7 +52,9 @@ public static DCSafeHandle CreateDC(string lpszDriver)
} }
[DllImport(ExternDll.Gdi32, ExactSpelling = true, CharSet = CharSet.Auto)] [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)] [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
#pragma warning restore SYSLIB0004 // The Constrained Execution Region (CER) feature is not supported.
[ResourceExposure(ResourceScope.None)] [ResourceExposure(ResourceScope.None)]
public static extern bool DeleteDC(IntPtr hDC); public static extern bool DeleteDC(IntPtr hDC);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册