From: Faizur Rahman Date: Fri, 4 Nov 2016 21:50:02 +0000 (-0700) Subject: Expose Marshal.CleanupUnusedObjectsInCurrentContext X-Git-Tag: accepted/tizen/base/20180629.140029~3113^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7a619b88d713a8e4fcd59c0d11ccc3f55155bab0;p=platform%2Fupstream%2Fcoreclr.git Expose Marshal.CleanupUnusedObjectsInCurrentContext This change exposes Marshal.CleanupUnusedObjectsInCurrentContext. Also it a GetHINSTANCE implementation for non-windows platform by throwing ArgumentNullException as per https://msdn.microsoft.com/en-us/library/system.runtime.interopservices.marshal.gethinstance(v=vs.110).aspx. --- diff --git a/src/mscorlib/model.xml b/src/mscorlib/model.xml index ee4d3b9..167be24 100644 --- a/src/mscorlib/model.xml +++ b/src/mscorlib/model.xml @@ -6791,6 +6791,7 @@ + diff --git a/src/mscorlib/ref/mscorlib.cs b/src/mscorlib/ref/mscorlib.cs index b7dcc5a..09e2905 100644 --- a/src/mscorlib/ref/mscorlib.cs +++ b/src/mscorlib/ref/mscorlib.cs @@ -10811,7 +10811,9 @@ namespace System.Runtime.InteropServices [System.Security.SecurityCriticalAttribute] public static object BindToMoniker(string monikerName) { throw null; } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.InternalCall)][System.Security.SecurityCritical] - public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak) { throw null; } + public static void ChangeWrapperHandleStrength(object otp, bool fIsWeak) { throw null; } + [System.Security.SecurityCriticalAttribute] + public static void CleanupUnusedObjectsInCurrentContext() { throw null; } [System.Security.SecurityCriticalAttribute] public static void Copy(byte[] source, int startIndex, System.IntPtr destination, int length) { } [System.Security.SecurityCriticalAttribute] diff --git a/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs b/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs index a3948bb..0c8ae76 100644 --- a/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs +++ b/src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs @@ -39,6 +39,12 @@ namespace System.Runtime.InteropServices } [System.Security.SecurityCriticalAttribute] + public static void CleanupUnusedObjectsInCurrentContext() + { + return; + } + + [System.Security.SecurityCriticalAttribute] public static System.IntPtr CreateAggregatedObject(System.IntPtr pOuter, T o) { throw new PlatformNotSupportedException(); @@ -89,6 +95,10 @@ namespace System.Runtime.InteropServices [System.Security.SecurityCriticalAttribute] public static System.IntPtr GetHINSTANCE(System.Reflection.Module m) { + if (m == null) + { + throw new ArgumentNullException(nameof(m)); + } return (System.IntPtr) (-1); } diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h index e8a0c96..7242314 100644 --- a/src/vm/ecalllist.h +++ b/src/vm/ecalllist.h @@ -1655,10 +1655,10 @@ FCFuncStart(gInteropMarshalFuncs) FCFuncElement("InitializeWrapperForWinRT", MarshalNative::InitializeWrapperForWinRT) FCFuncElement("GetTypedObjectForIUnknown", MarshalNative::GetTypedObjectForIUnknown) FCFuncElement("ChangeWrapperHandleStrength", MarshalNative::ChangeWrapperHandleStrength) + FCFuncElement("CleanupUnusedObjectsInCurrentContext", MarshalNative::CleanupUnusedObjectsInCurrentContext) #ifndef FEATURE_CORECLR FCFuncElement("GetLoadedTypeForGUID", MarshalNative::GetLoadedTypeForGUID) FCFuncElement("GetITypeInfoForType", MarshalNative::GetITypeInfoForType) - FCFuncElement("CleanupUnusedObjectsInCurrentContext", MarshalNative::CleanupUnusedObjectsInCurrentContext) FCFuncElement("IsTypeVisibleFromCom", MarshalNative::IsTypeVisibleFromCom) FCFuncElement("FCallGenerateGuidForType", MarshalNative::DoGenerateGuidForType) FCFuncElement("FCallGetTypeLibGuid", MarshalNative::DoGetTypeLibGuid)