Enable returning more complex structures via PInvoke returns. (#21470)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Fri, 11 Jan 2019 19:12:01 +0000 (11:12 -0800)
committerGitHub <noreply@github.com>
Fri, 11 Jan 2019 19:12:01 +0000 (11:12 -0800)
commit55b0d2790c75efe2b4a29a561127599668658e05
treedf27a20d05bfb0429987c7424c2e47531fc78819
parentca68a16fcb31162990fa9af9910e852a6cb66782
Enable returning more complex structures via PInvoke returns. (#21470)

* Add test verifying behavior in dotnet/coreclr#19676.

* Clean up test code.

* Test what happens if we enable returning structures by value.

* Use braced initializer.

* Update Decimal tests to expect that returning a decimal by LPStruct or Currency works.

* Change handle-in-struct marshalling to expect a NotSupportedException thrown at marshal time instead of expecting a MarshalDirectiveException at signature time.

* Update Decimal Reverse-PInvoke tests.

* Disable some previously disabled return marshalling types and add a nice comment block explaining why they're disabled.

* Enable marshalling DateTime return values and add a test.

* Rename IsUnuspportedValueTypeReturn

* Add return test for ArrayWithOffset

* Remove extraneous P/Invoke.

* Fix spelling.

* Add test for successfully returning a struct that has one field of a type that is return-type blocked.

* Add explicit struct return test.

* Clean up tests.

* Fix grammer.

* Add test for struct whose managed layout doesn't require a stdcall return buffer but whose native layout does.

* Add test verifying HandleRef behavior.

* Clean up IsUnsupportedTypedefReturn per PR feedback.
23 files changed:
src/vm/dllimport.cpp
src/vm/mlinfo.cpp
src/vm/mlinfo.h
tests/src/Interop/PInvoke/Array/MarshalArrayAsField/AsByValArray/AsByValArrayTest.cs
tests/src/Interop/PInvoke/Array/MarshalArrayAsField/LPArrayNative/MarshalArrayByValArrayNative.cpp
tests/src/Interop/PInvoke/ArrayWithOffset/ArrayWithOffsetNative.cpp
tests/src/Interop/PInvoke/ArrayWithOffset/ArrayWithOffsetTest.cs
tests/src/Interop/PInvoke/ArrayWithOffset/PInvokeDefs.cs
tests/src/Interop/PInvoke/CriticalHandles/StructTest/StructTest.cs
tests/src/Interop/PInvoke/DateTime/DateTimeTest.cs
tests/src/Interop/PInvoke/DateTime/NativeDateTime.cpp
tests/src/Interop/PInvoke/Decimal/PInvoke/DecNative.cpp
tests/src/Interop/PInvoke/Decimal/PInvoke/DecimalTest.cs
tests/src/Interop/PInvoke/Decimal/ReversePInvoke/DecimalTest.cs
tests/src/Interop/PInvoke/Miscellaneous/HandleRef/HandleRefNative.cpp
tests/src/Interop/PInvoke/Miscellaneous/HandleRef/HandleRefTest.cs
tests/src/Interop/PInvoke/SafeHandles/Misc.Unsupported/MiscUnsupportedTest.cs
tests/src/Interop/PInvoke/Varargs/VarargsNative.cpp
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutExp.cs
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsLayoutSeq.cs
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.cpp
tests/src/Interop/StructMarshalling/PInvoke/MarshalStructAsParamDLL.h
tests/src/Interop/StructMarshalling/PInvoke/Struct.cs