Throw an exception when passing strings by-value as out parameters. (#21513)
authorJeremy Koritzinsky <jkoritzinsky@gmail.com>
Wed, 6 Feb 2019 21:05:28 +0000 (13:05 -0800)
committerGitHub <noreply@github.com>
Wed, 6 Feb 2019 21:05:28 +0000 (13:05 -0800)
commit2f88f32ffb6752c89e6751b4747f1b9cd971304d
tree16a5e8e49cbb2d50df37a3d3b6f219de75f28c28
parentd5e903e7f8e881ef9fa8840df863422df4a7c62e
Throw an exception when passing strings by-value as out parameters. (#21513)

* Throw an exception when passing strings by-value as out parameters.

* Fix encoding

* Don't use override in this PR.

* Clean up Marshal_In

Marshal_In was copied back into existence from Marshal_InOut. Clean it up a bit.

* Remove extraneous whitespace.

* Fix failing test.

* Remove out attribute in COM string tests.

* Add back attribute and check for exception thow in COM tests.

* Add block comment to explain the implementation of Reverse_LPWStr_OutAttr in the NETServer.

* Only throw in a CLR->Native marshalling situation.

* Fix asserts from changed code-paths used in ILWSTRMarshaler.

* Add comment and explicitly load in a null value (instead of leaving it uninitialized).

* Apply suggestions from code review

Co-Authored-By: jkoritzinsky <jkoritzinsky@gmail.com>
Co-authored-by: Jan Vorlicek <janvorli@microsoft.com>
src/dlls/mscorrc/mscorrc.rc
src/dlls/mscorrc/resource.h
src/vm/ilmarshalers.cpp
src/vm/ilmarshalers.h
tests/src/Interop/COM/NETClients/Primitives/StringTests.cs
tests/src/Interop/COM/NETServer/StringTesting.cs
tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.cs
tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs