Nullable: System.Runtime.InteropServices.CustomMarshalers/WindowsRuntime (#23930)
[platform/upstream/coreclr.git] / src / System.Private.CoreLib / src / System / Runtime / InteropServices / CustomMarshalers / TypeToTypeInfoMarshaler.cs
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5 #nullable enable
6 namespace System.Runtime.InteropServices.CustomMarshalers
7 {
8     internal class TypeToTypeInfoMarshaler : ICustomMarshaler
9     {
10         private static readonly TypeToTypeInfoMarshaler s_typeToTypeInfoMarshaler = new TypeToTypeInfoMarshaler();
11
12         public static ICustomMarshaler GetInstance(string? cookie) => s_typeToTypeInfoMarshaler;
13
14         private TypeToTypeInfoMarshaler()
15         {
16         }
17
18         public void CleanUpManagedData(object ManagedObj)
19         {
20         }
21
22         public void CleanUpNativeData(IntPtr pNativeData)
23         {
24         }
25
26         public int GetNativeDataSize()
27         {
28             // Return -1 to indicate the managed type this marshaler handles is not a value type.
29             return -1;
30         }
31
32         public IntPtr MarshalManagedToNative(object ManagedObj)
33         {
34             throw new PlatformNotSupportedException(SR.PlatformNotSupported_ITypeInfo);
35         }
36
37         public object MarshalNativeToManaged(IntPtr pNativeData)
38         {
39             throw new PlatformNotSupportedException(SR.PlatformNotSupported_ITypeInfo);
40         }
41     }
42 }