From 71a11e3c93afaabfd46561d048beedc98e6e265a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Strehovsk=C3=BD?= Date: Thu, 7 Nov 2019 22:54:49 +0100 Subject: [PATCH] Check we don't marshal out parameters in SizeParamIndex test (dotnet/coreclr#27439) * Check we don't marshal out parameters in SizeParamIndex test The test passes both uninitialized (null) and initialized values to native. We can add a check to ensure the initialized value doesn't get marshalled to native. Commit migrated from https://github.com/dotnet/coreclr/commit/3ef9c7b2503a84d12edbb7e8c58b8e395632e98d --- .../tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/helper.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/coreclr/tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/helper.h b/src/coreclr/tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/helper.h index ca93822..5d82e63 100644 --- a/src/coreclr/tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/helper.h +++ b/src/coreclr/tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/helper.h @@ -107,6 +107,13 @@ BOOL CheckAndChangeArrayByRef(T ** ppActual, T* Actual_Array_Size, SIZE_T Expect template BOOL CheckAndChangeArrayByOut(T ** ppActual, T* Actual_Array_Size, SIZE_T Array_Size) { + if(*ppActual != NULL ) + { + printf("ManagedtoNative Error in Method: %s!\n",__FUNCTION__); + printf("Array is not NULL"); + return FALSE; + } + *ppActual = (T*)CoreClrAlloc(sizeof(T)*Array_Size); *Actual_Array_Size = ((T)Array_Size); -- 2.7.4