Throw an exception when passing strings by-value as out parameters. (dotnet/coreclr...
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)
commit393a1b6264ecfc0d8570f773382df92bb7121d14
treee38cadb82e5e3366086b5af4709cfda2534792a6
parente71a5088e77f548a138d1a076d00471777e13ffd
Throw an exception when passing strings by-value as out parameters. (dotnet/coreclr#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>
Commit migrated from https://github.com/dotnet/coreclr/commit/2f88f32ffb6752c89e6751b4747f1b9cd971304d
src/coreclr/src/dlls/mscorrc/mscorrc.rc
src/coreclr/src/dlls/mscorrc/resource.h
src/coreclr/src/vm/ilmarshalers.cpp
src/coreclr/src/vm/ilmarshalers.h
src/coreclr/tests/src/Interop/COM/NETClients/Primitives/StringTests.cs
src/coreclr/tests/src/Interop/COM/NETServer/StringTesting.cs
src/coreclr/tests/src/Interop/StringMarshalling/LPSTR/LPSTRTest.cs
src/coreclr/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTest.cs
src/coreclr/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestNative.cpp
src/coreclr/tests/src/Interop/StringMarshalling/LPTSTR/LPTSTRTestPInvokeDef.cs