diff options
Diffstat (limited to 'mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs')
-rw-r--r-- | mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs | 74 |
1 files changed, 12 insertions, 62 deletions
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs index b564f4150d0..7c3b5399b7d 100644 --- a/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs +++ b/mcs/class/corlib/System.Runtime.InteropServices/Marshal.cs @@ -45,7 +45,7 @@ using System.Runtime.InteropServices.ComTypes; using System.Text; using System.Runtime.ConstrainedExecution; -#if !FULL_AOT_RUNTIME && !NETCORE && !DISABLE_REMOTING +#if !FULL_AOT_RUNTIME && !DISABLE_REMOTING using Mono.Interop; #endif @@ -298,7 +298,7 @@ namespace System.Runtime.InteropServices public static object CreateWrapperOfType (object o, Type t) { -#if FULL_AOT_RUNTIME || NETCORE || DISABLE_REMOTING +#if FULL_AOT_RUNTIME || DISABLE_REMOTING throw new PlatformNotSupportedException (); #else __ComObject co = o as __ComObject; @@ -430,7 +430,7 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !MOBILE && !NETCORE +#if !MOBILE [MethodImplAttribute (MethodImplOptions.InternalCall)] private extern static IntPtr GetCCW (object o, Type T); @@ -446,7 +446,7 @@ namespace System.Runtime.InteropServices public static IntPtr GetComInterfaceForObject (object o, Type T) { -#if MOBILE || NETCORE +#if MOBILE throw new PlatformNotSupportedException (); #else IntPtr pItf = GetComInterfaceForObjectInternal (o, T); @@ -456,18 +456,16 @@ namespace System.Runtime.InteropServices } -#if !NETCORE public static IntPtr GetComInterfaceForObject (object o, Type T, CustomQueryInterfaceMode mode) { throw new NotImplementedException (); } -#endif public static IntPtr GetComInterfaceForObject<T, TInterface> (T o) { return GetComInterfaceForObject ((object)o, typeof (T)); } -#if !FULL_AOT_RUNTIME && !NETCORE && !MONOTOUCH +#if !FULL_AOT_RUNTIME && !MONOTOUCH public static IntPtr GetComInterfaceForObjectInContext (object o, Type t) { @@ -622,7 +620,7 @@ namespace System.Runtime.InteropServices public static void GetNativeVariantForObject (object obj, IntPtr pDstNativeVariant) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else Variant vt = new Variant(); @@ -642,7 +640,7 @@ namespace System.Runtime.InteropServices public static object GetObjectForIUnknown (IntPtr pUnk) { -#if MOBILE || FULL_AOT_RUNTIME || NETCORE +#if MOBILE || FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else object obj = GetObjectForCCW (pUnk); @@ -657,7 +655,7 @@ namespace System.Runtime.InteropServices public static object GetObjectForNativeVariant (IntPtr pSrcNativeVariant) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else Variant vt = (Variant)Marshal.PtrToStructure(pSrcNativeVariant, typeof(Variant)); @@ -667,7 +665,7 @@ namespace System.Runtime.InteropServices public static T GetObjectForNativeVariant<T> (IntPtr pSrcNativeVariant) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else Variant vt = (Variant)Marshal.PtrToStructure(pSrcNativeVariant, typeof(Variant)); @@ -677,7 +675,7 @@ namespace System.Runtime.InteropServices public static object[] GetObjectsForNativeVariants (IntPtr aSrcNativeVariant, int cVars) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else if (cVars < 0) @@ -692,7 +690,7 @@ namespace System.Runtime.InteropServices public static T[] GetObjectsForNativeVariants<T> (IntPtr aSrcNativeVariant, int cVars) { -#if FULL_AOT_RUNTIME || NETCORE +#if FULL_AOT_RUNTIME throw new PlatformNotSupportedException (); #else if (cVars < 0) @@ -717,18 +715,15 @@ namespace System.Runtime.InteropServices #if !FULL_AOT_RUNTIME && !MONOTOUCH -#if !NETCORE - [Obsolete ("This method has been deprecated")] public static Thread GetThreadFromFiberCookie (int cookie) { throw new NotImplementedException (); } -#endif public static object GetTypedObjectForIUnknown (IntPtr pUnk, Type t) { -#if NETCORE || DISABLE_REMOTING +#if DISABLE_REMOTING throw new NotImplementedException (); #else ComInteropProxy proxy = new ComInteropProxy (pUnk, t); @@ -749,7 +744,6 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !NETCORE [Obsolete] public static string GetTypeInfoName (UCOMITypeInfo pTI) @@ -763,7 +757,6 @@ namespace System.Runtime.InteropServices { throw new NotImplementedException (); } -#endif public static Guid GetTypeLibGuid (ITypeLib typelib) @@ -777,14 +770,12 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !NETCORE [Obsolete] public static int GetTypeLibLcid (UCOMITypeLib pTLB) { throw new NotImplementedException (); } -#endif public static int GetTypeLibLcid (ITypeLib typelib) @@ -792,14 +783,12 @@ namespace System.Runtime.InteropServices throw new NotImplementedException (); } -#if !NETCORE [Obsolete] public static string GetTypeLibName (UCOMITypeLib pTLB) { throw new NotImplementedException (); } -#endif public static string GetTypeLibName (ITypeLib typelib) @@ -838,12 +827,10 @@ namespace System.Runtime.InteropServices throw new PlatformNotSupportedException (); } -#if !NETCORE public static string GetTypeInfoName (ITypeInfo typeInfo) { throw new PlatformNotSupportedException (); } -#endif public static object GetUniqueObjectForIUnknown (IntPtr unknown) { @@ -1272,9 +1259,6 @@ namespace System.Runtime.InteropServices if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToBSTR (); -#else byte[] buffer = s.GetBuffer (); int len = s.Length; @@ -1289,7 +1273,6 @@ namespace System.Runtime.InteropServices } fixed (byte* fixed_buffer = buffer) return BufferToBSTR ((char*)fixed_buffer, len); -#endif } internal delegate IntPtr SecureStringAllocator(int len); @@ -1309,9 +1292,6 @@ namespace System.Runtime.InteropServices if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (false, false); -#else int len = s.Length; IntPtr ctm = allocator (len + 1); byte [] copy = new byte [len+1]; @@ -1334,16 +1314,12 @@ namespace System.Runtime.InteropServices } } return ctm; -#endif } internal static IntPtr SecureStringToUnicode (SecureString s, SecureStringAllocator allocator) { if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (false, true); -#else int len = s.Length; IntPtr ctm = allocator (len * 2 + 2); byte [] buffer = null; @@ -1360,8 +1336,6 @@ namespace System.Runtime.InteropServices } } return ctm; -#endif - } public static IntPtr SecureStringToCoTaskMemAnsi (SecureString s) @@ -1378,22 +1352,14 @@ namespace System.Runtime.InteropServices { if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (true, false); -#else return SecureStringToAnsi (s, SecureStringGlobalAllocator); -#endif } public static IntPtr SecureStringToGlobalAllocUnicode (SecureString s) { if (s == null) throw new ArgumentNullException ("s"); -#if NETCORE - return s.MarshalToString (true, true); -#else return SecureStringToUnicode (s, SecureStringGlobalAllocator); -#endif } [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.MayFail)] @@ -1646,9 +1612,6 @@ namespace System.Runtime.InteropServices //const int COR_E_WEAKREFERENCE = unchecked ((int)?); //const int COR_E_VTABLECALLSNOTSUPPORTED = unchecked ((int)); -#if NETCORE - return new COMException ("", errorCode); -#else switch (errorCode) { case MSEE_E_APPDOMAINUNLOADED: return new AppDomainUnloadedException (); @@ -1792,7 +1755,6 @@ namespace System.Runtime.InteropServices if (errorCode < 0) return new COMException ("", errorCode); return null; -#endif } #if FEATURE_COMINTEROP @@ -1939,18 +1901,6 @@ namespace System.Runtime.InteropServices [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void SetLastWin32Error (int error); -#if NETCORE - internal static IntPtr AllocBSTR (int length) - { - throw new NotImplementedException (); - } - - internal static bool IsPinnable (object obj) - { - throw new NotImplementedException (); - } -#endif - #if FEATURE_COMINTEROP || MONO_COM // Copied from referencesource/mscorlib/system/runtime/interopservices/marshal.cs //==================================================================== |