Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Check we don't marshal out parameters in SizeParamIndex test (#27439)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
MichalStrehovsky authored and AaronRobinsonMSFT committed Nov 7, 2019
1 parent ff6f382 commit 3ef9c7b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/src/Interop/PInvoke/SizeParamIndex/PInvoke/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ BOOL CheckAndChangeArrayByRef(T ** ppActual, T* Actual_Array_Size, SIZE_T Expect
template<typename T>
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);

Expand Down

0 comments on commit 3ef9c7b

Please sign in to comment.