diff options
author | Jeremy Koritzinsky <jekoritz@microsoft.com> | 2020-09-01 20:11:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-01 20:11:11 +0300 |
commit | 0f74067286e3fd422da603e0fc7eb46feb0ad8c6 (patch) | |
tree | 3716343c62098d31d596be492ba4040a71da943c /src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop | |
parent | 83fbd4e34d5256a904fa3fa923687b5e67f75a69 (diff) |
Add the struct marshalling attributes to Ancillary.Interop and add an analyzer that validates manual usage. (dotnet/runtimelab#61)
Co-authored-by: Elinor Fung <elfung@microsoft.com>
Commit migrated from https://github.com/dotnet/runtimelab/commit/05d6ef236f7bd698870b17e8abb1b7c6bb130198
Diffstat (limited to 'src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop')
-rw-r--r-- | src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/GeneratedMarshallingAttribute.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/GeneratedMarshallingAttribute.cs b/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/GeneratedMarshallingAttribute.cs new file mode 100644 index 00000000000..a483c22c191 --- /dev/null +++ b/src/libraries/System.Runtime.InteropServices/tests/Ancillary.Interop/GeneratedMarshallingAttribute.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace System.Runtime.InteropServices +{ + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] + class GeneratedMarshallingAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Struct)] + public class BlittableTypeAttribute : Attribute + { + } + + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class)] + public class NativeMarshallingAttribute : Attribute + { + public NativeMarshallingAttribute(Type nativeType) + { + NativeType = nativeType; + } + + public Type NativeType { get; } + } + + [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.Field)] + public class MarshalUsingAttribute : Attribute + { + public MarshalUsingAttribute(Type nativeType) + { + NativeType = nativeType; + } + + public Type NativeType { get; } + } +}
\ No newline at end of file |