summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Robinson <arobins@microsoft.com>2018-08-17 11:09:31 -0700
committerGitHub <noreply@github.com>2018-08-17 11:09:31 -0700
commitff9b943a050e515a8e4e0a9e152738279abdc35b (patch)
tree8a3f8e48aa4f36e5a73ab37ff5aca45ac195657e
parent0fc981abe7b9ca6898f157bc247edad265d4088b (diff)
downloadcoreclr-ff9b943a050e515a8e4e0a9e152738279abdc35b.tar.gz
coreclr-ff9b943a050e515a8e4e0a9e152738279abdc35b.tar.bz2
coreclr-ff9b943a050e515a8e4e0a9e152738279abdc35b.zip
Remove tests previously ported to CoreFX repo (#19527)
* Remove tests previously ported to CoreFX repo * Remove references to ported Marshal API tests
-rw-r--r--tests/arm/Tests.lst208
-rw-r--r--tests/arm64/Tests.lst208
-rw-r--r--tests/issues.targets9
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyByteArray.cs183
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyByteArray.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyCharArray.cs179
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyCharArray.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.cs177
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.cs175
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.cs179
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.cs177
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.cs184
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopySingleArray.cs181
-rw-r--r--tests/src/Interop/MarshalAPI/Copy/CopySingleArray.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.cs44
-rw-r--r--tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.cs99
-rw-r--r--tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj41
-rw-r--r--tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.cs144
-rw-r--r--tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.cs86
-rw-r--r--tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.cs165
-rw-r--r--tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.cs48
-rw-r--r--tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs496
-rw-r--r--tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj41
-rw-r--r--tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.cs374
-rw-r--r--tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj41
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.cs134
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.csproj43
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.cs144
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.csproj43
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.cs142
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.csproj43
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.cs149
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.csproj43
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.cs155
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.csproj43
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.cs116
-rw-r--r--tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.csproj40
-rw-r--r--tests/src/Interop/MarshalAPI/String/StringMarshalingTest.cs270
-rw-r--r--tests/src/Interop/MarshalAPI/String/StringMarshalingTest.csproj39
-rw-r--r--tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.cs91
-rw-r--r--tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj39
-rw-r--r--tests/testsUnsupportedOutsideWindows.txt3
52 files changed, 0 insertions, 5496 deletions
diff --git a/tests/arm/Tests.lst b/tests/arm/Tests.lst
index 0cd09e6b96..b18febd2ca 100644
--- a/tests/arm/Tests.lst
+++ b/tests/arm/Tests.lst
@@ -2892,14 +2892,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopyInt32Array.cmd_363]
-RelativePath=Interop\MarshalAPI\Copy\CopyInt32Array\CopyInt32Array.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyInt32Array
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[Generated528.cmd_364]
RelativePath=Loader\classloader\TypeGeneratorTests\TypeGeneratorTest528\Generated528\Generated528.cmd
WorkingDir=Loader\classloader\TypeGeneratorTests\TypeGeneratorTest528\Generated528
@@ -10940,14 +10932,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[ReadWriteInt64.cmd_1375]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteInt64\ReadWriteInt64.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteInt64
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[AutoConstructTrue.cmd_1376]
RelativePath=baseservices\threading\events\EventWaitHandle\unit\AutoConstructTrue\AutoConstructTrue.cmd
WorkingDir=baseservices\threading\events\EventWaitHandle\unit\AutoConstructTrue
@@ -12532,14 +12516,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopyInt64Array.cmd_1577]
-RelativePath=Interop\MarshalAPI\Copy\CopyInt64Array\CopyInt64Array.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyInt64Array
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[_il_dbgrefloc_o2.cmd_1578]
RelativePath=JIT\Methodical\explicit\basic\_il_dbgrefloc_o2\_il_dbgrefloc_o2.cmd
WorkingDir=JIT\Methodical\explicit\basic\_il_dbgrefloc_o2
@@ -15812,14 +15788,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS
HostStyle=0
-[StringMarshalingTest.cmd_1988]
-RelativePath=Interop\MarshalAPI\String\StringMarshalingTest\StringMarshalingTest.cmd
-WorkingDir=Interop\MarshalAPI\String\StringMarshalingTest
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;Pri1
-HostStyle=0
-
[b433189.cmd_1989]
RelativePath=JIT\Methodical\Coverage\b433189\b433189.cmd
WorkingDir=JIT\Methodical\Coverage\b433189
@@ -16236,14 +16204,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[UnsafeAddrOfPinnedArrayElement.cmd_2041]
-RelativePath=Interop\MarshalAPI\UnsafeAddrOfPinnedArrayElement\UnsafeAddrOfPinnedArrayElement\UnsafeAddrOfPinnedArrayElement.cmd
-WorkingDir=Interop\MarshalAPI\UnsafeAddrOfPinnedArrayElement\UnsafeAddrOfPinnedArrayElement
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;Pri1
-HostStyle=0
-
[Test1535.cmd_2042]
RelativePath=Regressions\coreclr\1535\Test1535\Test1535.cmd
WorkingDir=Regressions\coreclr\1535\Test1535
@@ -16556,14 +16516,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[ReadWriteByte.cmd_2081]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteByte\ReadWriteByte.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteByte
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[ThreadStartUInt.cmd_2082]
RelativePath=baseservices\threading\paramthreadstart\ThreadStartUInt\ThreadStartUInt.cmd
WorkingDir=baseservices\threading\paramthreadstart\ThreadStartUInt
@@ -18468,14 +18420,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[GetNativeVariantForObject.cmd_2321]
-RelativePath=Interop\MarshalAPI\GetNativeVariantForObject\GetNativeVariantForObject\GetNativeVariantForObject.cmd
-WorkingDir=Interop\MarshalAPI\GetNativeVariantForObject\GetNativeVariantForObject
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[Generated156.cmd_2322]
RelativePath=Loader\classloader\TypeGeneratorTests\TypeGeneratorTest156\Generated156\Generated156.cmd
WorkingDir=Loader\classloader\TypeGeneratorTests\TypeGeneratorTest156\Generated156
@@ -30060,14 +30004,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[FunctionPtrTest.cmd_3775]
-RelativePath=Interop\MarshalAPI\FunctionPointer\FunctionPtrTest\FunctionPtrTest.cmd
-WorkingDir=Interop\MarshalAPI\FunctionPointer\FunctionPtrTest
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[ArrayIndexOf4.cmd_3776]
RelativePath=CoreMangLib\cti\system\array\ArrayIndexOf4\ArrayIndexOf4.cmd
WorkingDir=CoreMangLib\cti\system\array\ArrayIndexOf4
@@ -38940,14 +38876,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[ReadWriteObject.cmd_4886]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteObject\ReadWriteObject.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteObject
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[bgt_i4.cmd_4887]
RelativePath=JIT\IL_Conformance\Old\Conformance_Base\bgt_i4\bgt_i4.cmd
WorkingDir=JIT\IL_Conformance\Old\Conformance_Base\bgt_i4
@@ -39292,14 +39220,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopyByteArray.cmd_4930]
-RelativePath=Interop\MarshalAPI\Copy\CopyByteArray\CopyByteArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyByteArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[GCSimulator_146.cmd_4931]
RelativePath=GC\Scenarios\GCSimulator\GCSimulator_146\GCSimulator_146.cmd
WorkingDir=GC\Scenarios\GCSimulator\GCSimulator_146
@@ -39404,14 +39324,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[ReadWriteInt32.cmd_4944]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteInt32\ReadWriteInt32.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteInt32
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[5w1d-02_cs_do.cmd_4945]
RelativePath=JIT\Methodical\fp\exgen\5w1d-02_cs_do\5w1d-02_cs_do.cmd
WorkingDir=JIT\Methodical\fp\exgen\5w1d-02_cs_do
@@ -40532,14 +40444,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[MarshalStructure.cmd_5085]
-RelativePath=Interop\MarshalAPI\MarshalStructure\MarshalStructure\MarshalStructure.cmd
-WorkingDir=Interop\MarshalAPI\MarshalStructure\MarshalStructure
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[_opt_relrefarg_s.cmd_5086]
RelativePath=JIT\Methodical\explicit\basic\_opt_relrefarg_s\_opt_relrefarg_s.cmd
WorkingDir=JIT\Methodical\explicit\basic\_opt_relrefarg_s
@@ -41292,14 +41196,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[GetExceptionForHR.cmd_5180]
-RelativePath=Interop\MarshalAPI\GetExceptionForHR\GetExceptionForHR\GetExceptionForHR.cmd
-WorkingDir=Interop\MarshalAPI\GetExceptionForHR\GetExceptionForHR
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[StringPadLeft2.cmd_5181]
RelativePath=CoreMangLib\cti\system\string\StringPadLeft2\StringPadLeft2.cmd
WorkingDir=CoreMangLib\cti\system\string\StringPadLeft2
@@ -43724,14 +43620,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[MarshalClassTests.cmd_5485]
-RelativePath=Interop\MarshalAPI\Miscellaneous\MarshalClassTests\MarshalClassTests.cmd
-WorkingDir=Interop\MarshalAPI\Miscellaneous\MarshalClassTests
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[hfa_sf2E_d.cmd_5486]
RelativePath=JIT\jit64\hfa\main\testE\hfa_sf2E_d\hfa_sf2E_d.cmd
WorkingDir=JIT\jit64\hfa\main\testE\hfa_sf2E_d
@@ -45356,14 +45244,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopyDoubleArray.cmd_5690]
-RelativePath=Interop\MarshalAPI\Copy\CopyDoubleArray\CopyDoubleArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyDoubleArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[GCSimulator_173.cmd_5691]
RelativePath=GC\Scenarios\GCSimulator\GCSimulator_173\GCSimulator_173.cmd
WorkingDir=GC\Scenarios\GCSimulator\GCSimulator_173
@@ -49884,14 +49764,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[GetObjectsForNativeVariants.cmd_6260]
-RelativePath=Interop\MarshalAPI\GetObjectsForNativeVariants\GetObjectsForNativeVariants\GetObjectsForNativeVariants.cmd
-WorkingDir=Interop\MarshalAPI\GetObjectsForNativeVariants\GetObjectsForNativeVariants
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[b49322.cmd_6261]
RelativePath=JIT\Regression\CLR-x86-JIT\V1-M11-Beta1\b49322\b49322\b49322.cmd
WorkingDir=JIT\Regression\CLR-x86-JIT\V1-M11-Beta1\b49322\b49322
@@ -58572,14 +58444,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[GetObjectForNativeVariant.cmd_7352]
-RelativePath=Interop\MarshalAPI\GetObjectForNativeVariant\GetObjectForNativeVariant\GetObjectForNativeVariant.cmd
-WorkingDir=Interop\MarshalAPI\GetObjectForNativeVariant\GetObjectForNativeVariant
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[hfa_sd0B_d.cmd_7353]
RelativePath=JIT\jit64\hfa\main\testB\hfa_sd0B_d\hfa_sd0B_d.cmd
WorkingDir=JIT\jit64\hfa\main\testB\hfa_sd0B_d
@@ -60092,14 +59956,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopySingleArray.cmd_7542]
-RelativePath=Interop\MarshalAPI\Copy\CopySingleArray\CopySingleArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopySingleArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[b72828.cmd_7543]
RelativePath=JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b72828\b72828\b72828.cmd
WorkingDir=JIT\Regression\CLR-x86-JIT\V1-M12-Beta2\b72828\b72828
@@ -66764,14 +66620,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[OffsetOf.cmd_8381]
-RelativePath=Interop\MarshalAPI\OffsetOf\OffsetOf\OffsetOf.cmd
-WorkingDir=Interop\MarshalAPI\OffsetOf\OffsetOf
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[DblDivConst.cmd_8382]
RelativePath=JIT\CodeGenBringUpTests\DblDivConst_ro\DblDivConst_ro.cmd
WorkingDir=JIT\CodeGenBringUpTests\DblDivConst_ro
@@ -68892,14 +68740,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopyIntPtrArray.cmd_8647]
-RelativePath=Interop\MarshalAPI\Copy\CopyIntPtrArray\CopyIntPtrArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyIntPtrArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[LVNumCnt1.cmd_8648]
RelativePath=JIT\opt\DumpDisasm\JitMinOpts\LVNumCnt1\LVNumCnt1.cmd
WorkingDir=JIT\opt\DumpDisasm\JitMinOpts\LVNumCnt1
@@ -74980,14 +74820,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[AutoLayoutStructure.cmd_9413]
-RelativePath=Interop\MarshalAPI\Miscellaneous\AutoLayoutStructure\AutoLayoutStructure.cmd
-WorkingDir=Interop\MarshalAPI\Miscellaneous\AutoLayoutStructure
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[b05784.cmd_9414]
RelativePath=JIT\Regression\CLR-x86-JIT\V1-M10\b05784\b05784\b05784.cmd
WorkingDir=JIT\Regression\CLR-x86-JIT\V1-M10\b05784\b05784
@@ -81108,14 +80940,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[CopyCharArray.cmd_10188]
-RelativePath=Interop\MarshalAPI\Copy\CopyCharArray\CopyCharArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyCharArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[NullableValue.cmd_10189]
RelativePath=CoreMangLib\cti\system\nullable\NullableValue\NullableValue.cmd
WorkingDir=CoreMangLib\cti\system\nullable\NullableValue
@@ -82060,14 +81884,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[IUnknownTest.cmd_10308]
-RelativePath=Interop\MarshalAPI\IUnknown\IUnknownTest\IUnknownTest.cmd
-WorkingDir=Interop\MarshalAPI\IUnknown\IUnknownTest
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[OpCodesConv_U.cmd_10309]
RelativePath=CoreMangLib\cti\system\reflection\emit\opcodes\OpCodesConv_U\OpCodesConv_U.cmd
WorkingDir=CoreMangLib\cti\system\reflection\emit\opcodes\OpCodesConv_U
@@ -83780,14 +83596,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[ReadWriteIntPtr.cmd_10525]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteIntPtr\ReadWriteIntPtr.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteIntPtr
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[b84958.cmd_10526]
RelativePath=JIT\Regression\VS-ia64-JIT\M00\b84958\b84958\b84958.cmd
WorkingDir=JIT\Regression\VS-ia64-JIT\M00\b84958\b84958
@@ -84764,14 +84572,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;Pri1
HostStyle=0
-[ReadWriteInt16.cmd_10648]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteInt16\ReadWriteInt16.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteInt16
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[_dbgexplicit7.cmd_10649]
RelativePath=JIT\Methodical\explicit\misc\_dbgexplicit7\_dbgexplicit7.cmd
WorkingDir=JIT\Methodical\explicit\misc\_dbgexplicit7
@@ -89196,14 +88996,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS
HostStyle=0
-[CopyInt16Array.cmd_11206]
-RelativePath=Interop\MarshalAPI\Copy\CopyInt16Array\CopyInt16Array.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyInt16Array
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
[Generated812.cmd_11207]
RelativePath=Loader\classloader\TypeGeneratorTests\TypeGeneratorTest812\Generated812\Generated812.cmd
WorkingDir=Loader\classloader\TypeGeneratorTests\TypeGeneratorTest812\Generated812
diff --git a/tests/arm64/Tests.lst b/tests/arm64/Tests.lst
index 25c6f7bb2b..2c7f403d63 100644
--- a/tests/arm64/Tests.lst
+++ b/tests/arm64/Tests.lst
@@ -25876,198 +25876,6 @@ MaxAllowedDurationSeconds=600
Categories=RT;EXPECTED_PASS;UNWIND
HostStyle=0
-[CopyByteArray.cmd_3481]
-RelativePath=Interop\MarshalAPI\Copy\CopyByteArray\CopyByteArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyByteArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopyCharArray.cmd_3482]
-RelativePath=Interop\MarshalAPI\Copy\CopyCharArray\CopyCharArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyCharArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopyDoubleArray.cmd_3483]
-RelativePath=Interop\MarshalAPI\Copy\CopyDoubleArray\CopyDoubleArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyDoubleArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopyInt16Array.cmd_3484]
-RelativePath=Interop\MarshalAPI\Copy\CopyInt16Array\CopyInt16Array.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyInt16Array
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopyInt32Array.cmd_3485]
-RelativePath=Interop\MarshalAPI\Copy\CopyInt32Array\CopyInt32Array.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyInt32Array
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopyInt64Array.cmd_3486]
-RelativePath=Interop\MarshalAPI\Copy\CopyInt64Array\CopyInt64Array.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyInt64Array
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopyIntPtrArray.cmd_3487]
-RelativePath=Interop\MarshalAPI\Copy\CopyIntPtrArray\CopyIntPtrArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopyIntPtrArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[CopySingleArray.cmd_3488]
-RelativePath=Interop\MarshalAPI\Copy\CopySingleArray\CopySingleArray.cmd
-WorkingDir=Interop\MarshalAPI\Copy\CopySingleArray
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[FunctionPtrTest.cmd_3489]
-RelativePath=Interop\MarshalAPI\FunctionPointer\FunctionPtrTest\FunctionPtrTest.cmd
-WorkingDir=Interop\MarshalAPI\FunctionPointer\FunctionPtrTest
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[GetExceptionForHR.cmd_3490]
-RelativePath=Interop\MarshalAPI\GetExceptionForHR\GetExceptionForHR\GetExceptionForHR.cmd
-WorkingDir=Interop\MarshalAPI\GetExceptionForHR\GetExceptionForHR
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[GetNativeVariantForObject.cmd_3491]
-RelativePath=Interop\MarshalAPI\GetNativeVariantForObject\GetNativeVariantForObject\GetNativeVariantForObject.cmd
-WorkingDir=Interop\MarshalAPI\GetNativeVariantForObject\GetNativeVariantForObject
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[GetObjectForNativeVariant.cmd_3492]
-RelativePath=Interop\MarshalAPI\GetObjectForNativeVariant\GetObjectForNativeVariant\GetObjectForNativeVariant.cmd
-WorkingDir=Interop\MarshalAPI\GetObjectForNativeVariant\GetObjectForNativeVariant
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[GetObjectsForNativeVariants.cmd_3493]
-RelativePath=Interop\MarshalAPI\GetObjectsForNativeVariants\GetObjectsForNativeVariants\GetObjectsForNativeVariants.cmd
-WorkingDir=Interop\MarshalAPI\GetObjectsForNativeVariants\GetObjectsForNativeVariants
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[IUnknownTest.cmd_3494]
-RelativePath=Interop\MarshalAPI\IUnknown\IUnknownTest\IUnknownTest.cmd
-WorkingDir=Interop\MarshalAPI\IUnknown\IUnknownTest
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[AutoLayoutStructure.cmd_3495]
-RelativePath=Interop\MarshalAPI\Miscellaneous\AutoLayoutStructure\AutoLayoutStructure.cmd
-WorkingDir=Interop\MarshalAPI\Miscellaneous\AutoLayoutStructure
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[MarshalClassTests.cmd_3496]
-RelativePath=Interop\MarshalAPI\Miscellaneous\MarshalClassTests\MarshalClassTests.cmd
-WorkingDir=Interop\MarshalAPI\Miscellaneous\MarshalClassTests
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[OffsetOf.cmd_3497]
-RelativePath=Interop\MarshalAPI\OffsetOf\OffsetOf\OffsetOf.cmd
-WorkingDir=Interop\MarshalAPI\OffsetOf\OffsetOf
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[ReadWriteByte.cmd_3498]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteByte\ReadWriteByte.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteByte
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[ReadWriteInt16.cmd_3499]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteInt16\ReadWriteInt16.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteInt16
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[ReadWriteInt32.cmd_3500]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteInt32\ReadWriteInt32.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteInt32
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[ReadWriteInt64.cmd_3501]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteInt64\ReadWriteInt64.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteInt64
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[ReadWriteIntPtr.cmd_3502]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteIntPtr\ReadWriteIntPtr.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteIntPtr
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS
-HostStyle=0
-
-[StringMarshalingTest.cmd_3503]
-RelativePath=Interop\MarshalAPI\String\StringMarshalingTest\StringMarshalingTest.cmd
-WorkingDir=Interop\MarshalAPI\String\StringMarshalingTest
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;Pri1
-HostStyle=0
-
-[UnsafeAddrOfPinnedArrayElement.cmd_3504]
-RelativePath=Interop\MarshalAPI\UnsafeAddrOfPinnedArrayElement\UnsafeAddrOfPinnedArrayElement\UnsafeAddrOfPinnedArrayElement.cmd
-WorkingDir=Interop\MarshalAPI\UnsafeAddrOfPinnedArrayElement\UnsafeAddrOfPinnedArrayElement
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;Pri1
-HostStyle=0
-
[NativeCallableTest.cmd_3505]
RelativePath=Interop\NativeCallable\NativeCallableTest\NativeCallableTest.cmd
WorkingDir=Interop\NativeCallable\NativeCallableTest
@@ -78084,14 +77892,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS;NEW;Pri1
HostStyle=0
-[MarshalStructure.cmd_10124]
-RelativePath=Interop\MarshalAPI\MarshalStructure\MarshalStructure\MarshalStructure.cmd
-WorkingDir=Interop\MarshalAPI\MarshalStructure\MarshalStructure
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;NEW
-HostStyle=0
-
[mcc_i32.cmd_10125]
RelativePath=JIT\jit64\mcc\interop\mcc_i32\mcc_i32.cmd
WorkingDir=JIT\jit64\mcc\interop\mcc_i32
@@ -90388,14 +90188,6 @@ MaxAllowedDurationSeconds=600
Categories=EXPECTED_PASS
HostStyle=0
-[ReadWriteObject.cmd_11676]
-RelativePath=Interop\MarshalAPI\ReadWrite\ReadWriteObject\ReadWriteObject.cmd
-WorkingDir=Interop\MarshalAPI\ReadWrite\ReadWriteObject
-Expected=0
-MaxAllowedDurationSeconds=600
-Categories=EXPECTED_PASS;NEW
-HostStyle=0
-
[GitHub_13404.cmd_11677]
RelativePath=JIT\Regression\JitBlue\GitHub_13404\GitHub_13404\GitHub_13404.cmd
WorkingDir=JIT\Regression\JitBlue\GitHub_13404\GitHub_13404
diff --git a/tests/issues.targets b/tests/issues.targets
index 3fab84be6e..aa379047df 100644
--- a/tests/issues.targets
+++ b/tests/issues.targets
@@ -537,15 +537,6 @@
<ExcludeList Include="$(XunitTestBinBase)\GC\Stress\Framework\ReliabilityFramework\ReliabilityFramework.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)\Interop\MarshalAPI\GetNativeVariantForObject\GetNativeVariantForObject\GetNativeVariantForObject.cmd">
- <Issue>needs triage</Issue>
- </ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)\Interop\MarshalAPI\GetObjectForNativeVariant\GetObjectForNativeVariant\GetObjectForNativeVariant.cmd">
- <Issue>needs triage</Issue>
- </ExcludeList>
- <ExcludeList Include="$(XunitTestBinBase)\Interop\MarshalAPI\GetObjectsForNativeVariants\GetObjectsForNativeVariants\GetObjectsForNativeVariants.cmd">
- <Issue>needs triage</Issue>
- </ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)\Interop\MarshalAPI\IUnknown\IUnknownTest\IUnknownTest.cmd">
<Issue>needs triage</Issue>
</ExcludeList>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyByteArray.cs b/tests/src/Interop/MarshalAPI/Copy/CopyByteArray.cs
deleted file mode 100644
index 80c8491386..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyByteArray.cs
+++ /dev/null
@@ -1,183 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyByteArrayTest
-{
- private byte[] TestArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- private bool IsArrayEqual(byte[] array1, byte[] array2)
- {
- if (array1.Length != array2.Length)
- {
-
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(byte[] array1, byte[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
-
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
-
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
-
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- byte[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
-
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
-
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(byte) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(byte) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- byte[] array = new byte[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- byte[] array = new byte[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyByteArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyByteArray.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyByteArray.csproj
deleted file mode 100644
index b24fcdd662..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyByteArray.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyByteArray</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyByteArray.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyCharArray.cs b/tests/src/Interop/MarshalAPI/Copy/CopyCharArray.cs
deleted file mode 100644
index d862d775bd..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyCharArray.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyCharArrayTest
-{
- private char[] TestArray = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' };
-
- private bool IsArrayEqual(char[] array1, char[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(char[] array1, char[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
-
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- char[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
- Assert.Fail("No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
-
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
-
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(char) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(char) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- char[] array = new char[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- char[] array = new char[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyCharArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyCharArray.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyCharArray.csproj
deleted file mode 100644
index b0e256af3d..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyCharArray.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyCharArray</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyCharArray.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.cs b/tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.cs
deleted file mode 100644
index ed0f5d2a15..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyDoubleArrayTest
-{
- private double[] TestArray = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0 };
-
- private bool IsArrayEqual(double[] array1, double[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(double[] array1, double[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- double[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(double) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(double) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- double[] array = new double[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- double[] array = new double[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyDoubleArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.csproj
deleted file mode 100644
index 7f8d0d7b24..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyDoubleArray.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyDoubleArray</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyDoubleArray.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.cs b/tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.cs
deleted file mode 100644
index 8b8036d9d8..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.cs
+++ /dev/null
@@ -1,175 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyInt16ArrayTest
-{
- private short[] TestArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- private bool IsArrayEqual(short[] array1, short[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(short[] array1, short[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- short[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(short) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(short) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- short[] array = new short[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- short[] array = new short[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyInt16ArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.csproj
deleted file mode 100644
index 1f696ed251..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyInt16Array.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyInt16Array</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyInt16Array.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.cs b/tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.cs
deleted file mode 100644
index 7a5a5a71bf..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyInt32ArrayTest
-{
- private int[] TestArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- private bool IsArrayEqual(int[] array1, int[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(int[] array1, int[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
-
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- int[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(int) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(int) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- int[] array = new int[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- int[] array = new int[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyInt32ArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.csproj
deleted file mode 100644
index d3410a0f24..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyInt32Array.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyInt32Array</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyInt32Array.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.cs b/tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.cs
deleted file mode 100644
index 86809224ca..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyInt64ArrayTest
-{
- private long[] TestArray = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
-
- private bool IsArrayEqual(long[] array1, long[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(long[] array1, long[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- long[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(long) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(long) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- long[] array = new long[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- long[] array = new long[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyInt64ArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.csproj
deleted file mode 100644
index 8b2c02a657..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyInt64Array.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyInt64Array</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyInt64Array.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.cs b/tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.cs
deleted file mode 100644
index 687e6ad3a7..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopyIntPtrArrayTest
-{
- private IntPtr[] TestArray;
-
- private bool IsArrayEqual(IntPtr[] array1, IntPtr[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(IntPtr[] array1, IntPtr[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- IntPtr[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = IntPtr.Size * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy more elements than the TestArray has.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from an out of bound startIndex.");
- }
- catch (ArgumentOutOfRangeException)
- {
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
-
- Assert.Fail("Failed out of range values test. No exception from Copy when trying to copy from a positive startIndex, with length taking it out of bounds.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = IntPtr.Size * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- IntPtr[] array = new IntPtr[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- IntPtr[] array = new IntPtr[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public CopyIntPtrArrayTest()
- {
- TestArray = new IntPtr[10];
- for (int i = 0; i < TestArray.Length; i++)
- TestArray[i] = new IntPtr(i);
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopyIntPtrArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.csproj b/tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.csproj
deleted file mode 100644
index 71eb32610a..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopyIntPtrArray.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopyIntPtrArray</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopyIntPtrArray.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopySingleArray.cs b/tests/src/Interop/MarshalAPI/Copy/CopySingleArray.cs
deleted file mode 100644
index 7023849547..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopySingleArray.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-using CoreFXTestLibrary;
-
-public class CopySingleArrayTest
-{
- private float[] TestArray = { 0.0F, 1.0F, 2.0F, 3.0F, 4.0F, 5.0F, 6.0F, 7.0F, 8.0F, 9.0F };
-
- private bool IsArrayEqual(float[] array1, float[] array2)
- {
- if (array1.Length != array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < array1.Length; i++)
- if (!array1[i].Equals(array2[i]))
- {
- return false;
- }
-
- return true;
- }
-
- private bool IsSubArrayEqual(float[] array1, float[] array2, int startIndex, int Length)
- {
- if (startIndex + Length > array1.Length)
- {
-
- return false;
- }
-
- if (startIndex + Length > array2.Length)
- {
- return false;
- }
-
- for (int i = 0; i < Length; i++)
- if (!array1[startIndex + i].Equals(array2[startIndex + i]))
- {
- return false;
- }
-
- return true;
- }
-
- private void NullValueTests()
- {
- float[] array = null;
-
- try
- {
- Marshal.Copy(array, 0, IntPtr.Zero, 0);
-
- Assert.Fail("Failed null values test. No exception from Copy when passed null as parameter.");
- }
- catch (ArgumentNullException)
- {
-
- }
-
- try
- {
- Marshal.Copy(IntPtr.Zero, array, 0, 0);
- Assert.Fail("Failed null values test.");
- }
- catch (ArgumentNullException)
- {
-
- }
- }
-
- private void OutOfRangeTests()
- {
- int sizeOfArray = sizeof(float) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- try //try to copy more elements than the TestArray has
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length + 1);
- Assert.Fail("Failed out of range values test.");
-
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- try //try to copy from an out of bound startIndex
- {
- Marshal.Copy(TestArray, TestArray.Length + 1, ptr, 1);
- Assert.Fail("Failed out of range values test.");
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- try //try to copy from a positive startIndex, with length taking it out of bounds
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length);
- Assert.Fail("Failed out of range values test.");
-
- }
- catch (ArgumentOutOfRangeException)
- {
-
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- private void CopyRoundTripTests()
- {
- int sizeOfArray = sizeof(float) * TestArray.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- //try to copy the entire array
- {
- Marshal.Copy(TestArray, 0, ptr, TestArray.Length);
-
- float[] array = new float[TestArray.Length];
-
- Marshal.Copy(ptr, array, 0, TestArray.Length);
-
- if (!IsArrayEqual(TestArray, array))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip copied arrays do not match.");
- }
- }
-
- //try to copy part of the array
- {
- Marshal.Copy(TestArray, 2, ptr, TestArray.Length - 4);
-
- float[] array = new float[TestArray.Length];
-
- Marshal.Copy(ptr, array, 2, TestArray.Length - 4);
-
- if (!IsSubArrayEqual(TestArray, array, 2, TestArray.Length - 4))
- {
- Assert.Fail("Failed copy round trip test. Original array and round trip partially copied arrays do not match.");
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- OutOfRangeTests();
- CopyRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- try
- {
- new CopySingleArrayTest().RunTests();
- }
- catch (Exception e)
- {
- Console.WriteLine("Test failure: " + e.Message);
- return 101;
- }
-
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/Copy/CopySingleArray.csproj b/tests/src/Interop/MarshalAPI/Copy/CopySingleArray.csproj
deleted file mode 100644
index 72d074a7c5..0000000000
--- a/tests/src/Interop/MarshalAPI/Copy/CopySingleArray.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>CopySingleArray</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="CopySingleArray.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.cs b/tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.cs
deleted file mode 100644
index ae88f97b8a..0000000000
--- a/tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Diagnostics;
-
-public class GetExceptionForHRTest
-{
- //HR:0x80020006
- void RunTests1()
- {
-
- int err = unchecked((int)0x80020006);
- Exception ex = Marshal.GetExceptionForHR(err);
- if(ex.HResult != err) throw new Exception();
- }
-
- //0x80020101
- void RunTest2()
- {
- int err = unchecked((int)0x80020101);
- Exception ex = Marshal.GetExceptionForHR(err);
- if(ex.HResult != err) throw new Exception();
- }
-
- public bool RunTests()
- {
- RunTests1();
- RunTest2();
- return true;
- }
-
- public static int Main(String[] unusedArgs)
- {
- if (new GetExceptionForHRTest().RunTests())
- return 100;
- return 99;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.csproj b/tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.csproj
deleted file mode 100644
index 9f1bc7bd0f..0000000000
--- a/tests/src/Interop/MarshalAPI/GetExceptionForHR/GetExceptionForHR.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>GetExceptionForHR</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.cs b/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.cs
deleted file mode 100644
index 89ec450fc7..0000000000
--- a/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-
-public class GetNativeVariantForObjectTest
-{
- internal struct Variant
- {
- public ushort vt;
- public ushort wReserved1;
- public ushort wReserved2;
- public ushort wReserved3;
- public IntPtr bstrVal;
- public IntPtr pRecInfo;
- }
-
- public static void NullParameter()
- {
- Assert.Throws<ArgumentNullException>(() => Marshal.GetNativeVariantForObject(new object(),IntPtr.Zero));
- Assert.Throws<ArgumentNullException>(() => Marshal.GetNativeVariantForObject<int>(1, IntPtr.Zero));
- }
-
- public static void EmptyObject()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject(null, pNative);
- object o = Marshal.GetObjectForNativeVariant(pNative);
- Assert.AreEqual(null, o);
- }
-
- public static void PrimitiveType()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<ushort>(99, pNative);
- ushort actual = Marshal.GetObjectForNativeVariant<ushort>(pNative);
- Assert.AreEqual(99, actual);
- }
-
- public static void Char()
- {
- // GetNativeVariantForObject supports char, but internally recognizes it the same as ushort
- // because the native variant type uses mscorlib type VarEnum to store what type it contains.
- // To get back the original char, use GetObjectForNativeVariant<ushort> and cast to char.
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<char>('a', pNative);
- ushort actual = Marshal.GetObjectForNativeVariant<ushort>(pNative);
- char actualChar = (char)actual;
- Assert.AreEqual('a', actual);
- }
-
- public static void CharNegative()
- {
- // While GetNativeVariantForObject supports taking chars, GetObjectForNativeVariant will
- // never return a char. The internal type is ushort, as mentioned above. This behavior
- // is the same on ProjectN and Desktop CLR.
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<char>('a', pNative);
- Assert.Throws<InvalidCastException>(() =>
- {
- char actual = Marshal.GetObjectForNativeVariant<char>(pNative);
- Assert.AreEqual('a', actual);
- });
- }
-
- public static void StringType()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<string>("99", pNative);
- string actual = Marshal.GetObjectForNativeVariant<string>(pNative);
- Assert.AreEqual("99", actual);
- }
-
- public static void DoubleType()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<double>(3.14, pNative);
- double actual = Marshal.GetObjectForNativeVariant<double>(pNative);
- Assert.AreEqual(3.14, actual);
- }
-
- public static int Main(String[] unusedArgs)
- {
- EmptyObject();
- PrimitiveType();
- Char();
- CharNegative();
- StringType();
- DoubleType();
- return 100;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj b/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj
deleted file mode 100644
index 6ef3c98f13..0000000000
--- a/tests/src/Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>GetNativeVariantForObject</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- <NoWarn>0618;0649</NoWarn>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.cs b/tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.cs
deleted file mode 100644
index e23690bffb..0000000000
--- a/tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-#pragma warning disable 618
-
-public class GetObjectForNativeVariantTest
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct Record {
- private IntPtr _record;
- private IntPtr _recordInfo;
- }
-
- [StructLayout(LayoutKind.Explicit)]
- public struct UnionTypes {
- [FieldOffset(0)] internal SByte _i1;
- [FieldOffset(0)] internal Int16 _i2;
- [FieldOffset(0)] internal Int32 _i4;
- [FieldOffset(0)] internal Int64 _i8;
- [FieldOffset(0)] internal Byte _ui1;
- [FieldOffset(0)] internal UInt16 _ui2;
- [FieldOffset(0)] internal UInt32 _ui4;
- [FieldOffset(0)] internal UInt64 _ui8;
- [FieldOffset(0)] internal Int32 _int;
- [FieldOffset(0)] internal UInt32 _uint;
- [FieldOffset(0)] internal Single _r4;
- [FieldOffset(0)] internal Double _r8;
- [FieldOffset(0)] internal Int64 _cy;
- [FieldOffset(0)] internal double _date;
- [FieldOffset(0)] internal IntPtr _bstr;
- [FieldOffset(0)] internal IntPtr _unknown;
- [FieldOffset(0)] internal IntPtr _dispatch;
- [FieldOffset(0)] internal IntPtr _pvarVal;
- [FieldOffset(0)] internal IntPtr _byref;
- [FieldOffset(0)] internal Record _record;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct TypeUnion
- {
- public ushort vt;
- public ushort wReserved1;
- public ushort wReserved2;
- public ushort wReserved3;
- public UnionTypes _unionTypes;
- }
-
- [StructLayout(LayoutKind.Explicit)]
- internal struct Variant
- {
- [FieldOffset(0)] public TypeUnion m_Variant;
- [FieldOffset(0)] public decimal m_decimal;
- }
-
- public static void NullParameter()
- {
- Assert.Throws<ArgumentNullException>(() => Marshal.GetObjectForNativeVariant(IntPtr.Zero));
- Assert.Throws<ArgumentNullException>(() => Marshal.GetObjectForNativeVariant<int>(IntPtr.Zero));
- }
-
- [DllImport(@"oleaut32.dll", SetLastError = true, CallingConvention = CallingConvention.StdCall)]
- static extern Int32 VariantClear(IntPtr pvarg);
-
- private static void DeleteVariant(IntPtr pVariant)
- {
- VariantClear(pVariant);
- Marshal.FreeHGlobal(pVariant);
- }
-
- public static void Decimal()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject(3.14m, pNative);
- decimal d = Marshal.GetObjectForNativeVariant<decimal>(pNative);
- Assert.AreEqual(3.14m, d);
-
- DeleteVariant(pNative);
- }
-
- public static void PrimitiveType()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<ushort>(99, pNative);
- ushort actual = Marshal.GetObjectForNativeVariant<ushort>(pNative);
- Assert.AreEqual(99, actual);
-
- DeleteVariant(pNative);
- }
-
- public static void StringType()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<string>("99", pNative);
- string actual = Marshal.GetObjectForNativeVariant<string>(pNative);
- Assert.AreEqual("99", actual);
-
- DeleteVariant(pNative);
- }
-
- public static void DoubleType()
- {
- Variant v = new Variant();
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<double>(3.14, pNative);
- double actual = Marshal.GetObjectForNativeVariant<double>(pNative);
- Assert.AreEqual(3.14, actual);
-
- DeleteVariant(pNative);
- }
-
- public static void IUnknownType()
- {
- Variant v = new Variant();
- object obj = new object();
-
- // Technically we don't need this - but this is necessary for forcing
- // COM initialization
- IntPtr pUnk = Marshal.GetIUnknownForObject(obj);
- IntPtr pNative = Marshal.AllocHGlobal(Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<object>(obj, pNative);
- object actual = Marshal.GetObjectForNativeVariant<object>(pNative);
- Assert.AreEqual(obj, actual);
- Marshal.Release(pUnk);
-
- DeleteVariant(pNative);
- }
-
- public static int Main(String[] unusedArgs)
- {
- IUnknownType();
- DoubleType();
- StringType();
- PrimitiveType();
- Decimal();
- NullParameter();
- return 100;
- }
-}
-#pragma warning restore 618 \ No newline at end of file
diff --git a/tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.csproj b/tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.csproj
deleted file mode 100644
index 4bc3b639f0..0000000000
--- a/tests/src/Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>GetObjectForNativeVariant</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.cs b/tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.cs
deleted file mode 100644
index 6a55638d92..0000000000
--- a/tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-#pragma warning disable 618
-public class GetObjectsForNativeVariantsTest
-{
- [StructLayout(LayoutKind.Sequential)]
- public struct Record {
- private IntPtr _record;
- private IntPtr _recordInfo;
- }
-
- [StructLayout(LayoutKind.Explicit)]
- public struct UnionTypes {
- [FieldOffset(0)] internal SByte _i1;
- [FieldOffset(0)] internal Int16 _i2;
- [FieldOffset(0)] internal Int32 _i4;
- [FieldOffset(0)] internal Int64 _i8;
- [FieldOffset(0)] internal Byte _ui1;
- [FieldOffset(0)] internal UInt16 _ui2;
- [FieldOffset(0)] internal UInt32 _ui4;
- [FieldOffset(0)] internal UInt64 _ui8;
- [FieldOffset(0)] internal Int32 _int;
- [FieldOffset(0)] internal UInt32 _uint;
- [FieldOffset(0)] internal Single _r4;
- [FieldOffset(0)] internal Double _r8;
- [FieldOffset(0)] internal Int64 _cy;
- [FieldOffset(0)] internal double _date;
- [FieldOffset(0)] internal IntPtr _bstr;
- [FieldOffset(0)] internal IntPtr _unknown;
- [FieldOffset(0)] internal IntPtr _dispatch;
- [FieldOffset(0)] internal IntPtr _pvarVal;
- [FieldOffset(0)] internal IntPtr _byref;
- [FieldOffset(0)] internal Record _record;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- internal struct TypeUnion
- {
- public ushort vt;
- public ushort wReserved1;
- public ushort wReserved2;
- public ushort wReserved3;
- public UnionTypes _unionTypes;
- }
-
- [StructLayout(LayoutKind.Explicit)]
- internal struct Variant
- {
- [FieldOffset(0)] public TypeUnion m_Variant;
- [FieldOffset(0)] public decimal m_decimal;
- }
-
- public static void NullParameter()
- {
- Assert.Throws<ArgumentNullException>(() => Marshal.GetObjectsForNativeVariants(IntPtr.Zero, 10));
- Assert.Throws<ArgumentOutOfRangeException>(() => Marshal.GetObjectsForNativeVariants<int>(new IntPtr(100), -1));
- }
-
- public static void UshortType()
- {
-
- Variant v = new Variant();
-
- IntPtr pNative = Marshal.AllocHGlobal(2 * Marshal.SizeOf(v));
- Marshal.GetNativeVariantForObject<ushort>(99, pNative);
- Marshal.GetNativeVariantForObject<ushort>(100, pNative +Marshal.SizeOf(v));
-
-
- ushort[] actual = Marshal.GetObjectsForNativeVariants<ushort>(pNative,2);
- Assert.AreEqual(99, actual[0]);
- Assert.AreEqual(100, actual[1]);
-
- Marshal.FreeHGlobal(pNative);
-
- }
- public static int Main(String[] args)
- {
- UshortType();
- NullParameter();
- return 100;
- }
-}
-#pragma warning restore 618 \ No newline at end of file
diff --git a/tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.csproj b/tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.csproj
deleted file mode 100644
index da6e9cd99b..0000000000
--- a/tests/src/Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>GetObjectsForNativeVariants</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.cs b/tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.cs
deleted file mode 100644
index 0497f8fdc1..0000000000
--- a/tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.cs
+++ /dev/null
@@ -1,165 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-class Program
-{
- static int Main(string[] args)
- {
- VerifyByValBoolArray();
- VerifyByValArrayInStruct();
- VerfiyByValDateArray();
- return 100;
- }
-
- static void VerifyByValBoolArray()
- {
- var structure1 = new StructWithBoolArray()
- {
- array = new bool[]
- {
- true,true,true,true
- }
- };
-
- int size = Marshal.SizeOf(structure1);
- IntPtr memory = Marshal.AllocHGlobal(size + sizeof(Int32));
-
- try
- {
- Marshal.WriteInt32(memory, size, 0xFF);
- Marshal.StructureToPtr(structure1, memory, false);
-
- if (Marshal.ReadInt32(memory, size) != 0xFF)
- throw new Exception("Marshal.StructureToPtr buffer overwritten...");
- }
- finally
- {
- Marshal.FreeHGlobal(memory);
- }
- }
-
- static void VerifyByValArrayInStruct()
- {
- // equal
- var structure1 = new StructWithByValArray()
- {
- array = new StructWithIntField[]
- {
- new StructWithIntField { value = 1 },
- new StructWithIntField { value = 2 },
- new StructWithIntField { value = 3 },
- new StructWithIntField { value = 4 },
- new StructWithIntField { value = 5 }
- }
- };
- int size = Marshal.SizeOf(structure1);
- IntPtr memory = Marshal.AllocHGlobal(size);
- try
- {
- Marshal.StructureToPtr(structure1, memory, false);
- }
- finally
- {
- Marshal.FreeHGlobal(memory);
- }
-
- // underflow
- var structure2 = new StructWithByValArray()
- {
- array = new StructWithIntField[]
- {
- new StructWithIntField { value = 1 },
- new StructWithIntField { value = 2 },
- new StructWithIntField { value = 3 },
- new StructWithIntField { value = 4 }
- }
- };
- bool expectedException = false;
- size = Marshal.SizeOf(structure2);
- memory = Marshal.AllocHGlobal(size);
- try
- {
- Marshal.StructureToPtr(structure2, memory, false);
- }
- catch (ArgumentException)
- {
- expectedException = true;
- }
- finally
- {
- Marshal.FreeHGlobal(memory);
- }
- if (!expectedException)
- throw new Exception("Expected ArgumentException");
-
- // overflow
- var structure3 = new StructWithByValArray()
- {
- array = new StructWithIntField[]
- {
- new StructWithIntField { value = 1 },
- new StructWithIntField { value = 2 },
- new StructWithIntField { value = 3 },
- new StructWithIntField { value = 4 },
- new StructWithIntField { value = 5 },
- new StructWithIntField { value = 6 }
- }
- };
-
- size = Marshal.SizeOf(structure3);
- memory = Marshal.AllocHGlobal(size);
- try
- {
- Marshal.StructureToPtr(structure3, memory, false);
- }
- finally
- {
- Marshal.FreeHGlobal(memory);
- }
- }
-
- static void VerfiyByValDateArray()
- {
- var structure1 = new StructWithDateArray()
- {
- array = new DateTime[]
- {
- DateTime.Now, DateTime.Now , DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now , DateTime.Now, DateTime.Now
- }
- };
-
- int size = Marshal.SizeOf(structure1);
- IntPtr memory = Marshal.AllocHGlobal(size);
- try
- {
- Marshal.StructureToPtr(structure1, memory, false);
- }
- finally
- {
- Marshal.FreeHGlobal(memory);
- }
- }
-
- public struct StructWithIntField
- {
- public int value;
- }
-
- public struct StructWithByValArray
- {
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
- public StructWithIntField[] array;
- }
-
- public struct StructWithBoolArray
- {
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
- public bool[] array;
- }
-
- public struct StructWithDateArray
- {
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
- public DateTime[] array;
- }
-} \ No newline at end of file
diff --git a/tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.csproj b/tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.csproj
deleted file mode 100644
index 9083ab0c30..0000000000
--- a/tests/src/Interop/MarshalAPI/MarshalStructure/MarshalStructure.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>MarshalStructure</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.cs b/tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.cs
deleted file mode 100644
index 98f0cbab24..0000000000
--- a/tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.Reflection;
-using System.Threading;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-
-class MarshalClassTests
-{
- [StructLayout(LayoutKind.Auto)]
- public struct SomeTestStruct_Auto
- {
- public int i;
- }
-
- [STAThread]
- static int Main()
- {
- SomeTestStruct_Auto someTs_Auto = new SomeTestStruct_Auto();
- try
- {
- Marshal.StructureToPtr(someTs_Auto, new IntPtr(123), true);
- }
- catch (ArgumentException ex)
- {
- if (ex.ParamName != "structure")
- {
- Console.WriteLine("Thrown ArgumentException is incorrect.");
- return 103;
- }
- if (!ex.Message.Contains("The specified structure must be blittable or have layout information."))
- {
- Console.WriteLine("Thrown ArgumentException is incorrect.");
- return 104;
- }
- return 100;
- }
- catch (Exception e)
- {
- Console.WriteLine("Marshal.StructureToPtr threw unexpected exception {0}.", e);
- return 102;
- }
- Console.WriteLine("Marshal.StructureToPtr did not throw an exception.");
- return 101;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.csproj b/tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.csproj
deleted file mode 100644
index 19858c1ef0..0000000000
--- a/tests/src/Interop/MarshalAPI/Miscellaneous/AutoLayoutStructure.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>AutoLayoutStructure</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AutoLayoutStructure.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs b/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs
deleted file mode 100644
index 4c4396c4c3..0000000000
--- a/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.cs
+++ /dev/null
@@ -1,496 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.Reflection;
-using System.Threading;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-
-class MarshalClassTests
-{
- //definition of structure that will be used in testing of structs with Fixed BSTR Safearray fields
- internal struct Variant
- {
- public ushort vt;
- public ushort wReserved1;
- public ushort wReserved2;
- public ushort wReserved3;
- public IntPtr bstrVal;
- public IntPtr pRecInfo;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct StructWithFxdLPSTRSAFld
- {
- [MarshalAs(UnmanagedType.ByValArray, ArraySubType = UnmanagedType.LPStr, SizeConst = 0)]
- public String[] Arr;
- }
-
- [StructLayout(LayoutKind.Sequential)]
- public struct SomeTestStruct
- {
- public int i;
- //[MarshalAs(UnmanagedType.BStr)]
- public String s;
- }
-
- public enum TestEnum
- {
- red,
- green,
- blue
- }
-
-#if BUG_876976
- public struct TestStructWithEnumArray
- {
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
- public TestEnum[] ArrayOfEnum;
- }
-#endif
-
- [STAThread]
- static int Main()
- {
- int retVal = 100;
-
- IntPtr ip;
- SomeTestStruct someTs = new SomeTestStruct();
-
-#if BUG_876976
- Console.WriteLine("Testing SizeOf...");
- try
- {
- TestStructWithEnumArray s = new TestStructWithEnumArray();
- s.ArrayOfEnum = new TestEnum[3];
- s.ArrayOfEnum[0] = TestEnum.red;
- s.ArrayOfEnum[1] = TestEnum.green;
- s.ArrayOfEnum[2] = TestEnum.blue;
- Console.WriteLine("\tFirst call to SizeOf with TestStructWithEnumArray...");
- int retsize = Marshal.SizeOf(s.GetType());
- if (retsize != 12)
- {
- retVal = 0;
- Console.WriteLine("\t\tSize returned != 12");
- Console.WriteLine("\t\tReturned size = " + retsize);
- }
-
- retsize = 0;
- Console.WriteLine("\tSecond call to SizeOf with TestStructWithEnumArray...");
- retsize = Marshal.SizeOf(typeof(TestStructWithEnumArray));
- int genericRetsize = Marshal.SizeOf<TestStructWithEnumArray>();
-
- if (retsize != genericRetsize)
- {
- retVal = 0;
- Console.WriteLine("\t\tERROR: Generic and non generic versions of the API did not return the same size!");
- }
-
- if (retsize != 12)
- {
- retVal = 0;
- Console.WriteLine("\t\tSize returned != 12");
- Console.WriteLine("\t\tReturned size = " + retsize);
- }
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-#endif
-
-#if BUG_879268
- //////////////////////////////////////////////////////////////
- //StructureToPtr
- /////////////////////////////////////////////////////////////
- Console.WriteLine("Testing StructureToPtr...");
- Console.WriteLine("\tPassing IntPtr=IntPtr.Zero");
- ip = IntPtr.Zero;
- try
- {
- Marshal.StructureToPtr<SomeTestStruct>(someTs, ip, true);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing structure=null");
- ip = new IntPtr(123);
- try
- {
- Marshal.StructureToPtr<Object>(null, ip, true);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-#endif
- Console.WriteLine("\n\tPassing proper structure, proper IntPtr and fDeleteOld=true to hit remaining code paths");
- ip = Marshal.AllocHGlobal(Marshal.SizeOf(someTs));
- someTs.s = "something";
- Marshal.StructureToPtr(someTs, ip, false);
-#if BUG_879268
- Marshal.StructureToPtr(someTs, ip, true);
-#endif
- Console.WriteLine("DONE testing StructureToPtr.");
-
-
- //////////////////////////////////////////////////////////////
- //PtrToStructure
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting PtrToStructure...");
-#if BUG_878933
- Console.WriteLine("\tPassing IntPtr=IntPtr.Zero");
- ip = IntPtr.Zero;
- try
- {
- Marshal.PtrToStructure(ip, someTs);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing structure=null");
- ip = new IntPtr(123);
- try
- {
- Marshal.PtrToStructure(ip, null);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-#endif
-
- Console.WriteLine("\n\tPassing a value class to method override that expects a class and returns void");
- try
- {
- ip = new IntPtr(123);
- Marshal.PtrToStructure<SomeTestStruct>(ip, someTs);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("DONE testing PtrToStructure.");
-
-#if BUG_879277
- //////////////////////////////////////////////////////////////
- //DestroyStructure
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting DestroyStructure...");
- Console.WriteLine("\tPassing IntPtr=IntPtr.Zero");
- ip = IntPtr.Zero;
- try
- {
- Marshal.DestroyStructure<SomeTestStruct>(ip);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing structuretype=null");
- ip = new IntPtr(123);
- try
- {
- Marshal.DestroyStructure(ip, null);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing structuretype that does not have layout i.e. it has AUTO layout");
- try
- {
- Marshal.DestroyStructure(ip, someTs_Auto.GetType());
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing structuretype that does have layout i.e. the positive test case");
- ip = Marshal.AllocHGlobal(Marshal.SizeOf(someTs));
- someTs.s = null;
- Marshal.StructureToPtr(someTs, ip, false);
- Marshal.DestroyStructure<SomeTestStruct>(ip);
-
- Console.WriteLine("DONE testing DestroyStructure.");
-#endif
-
- //////////////////////////////////////////////////////////////
- //SizeOf
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting SizeOf...");
- Console.WriteLine("\n\tPassing structure=null");
- try
- {
- Marshal.SizeOf(null);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
-#if BUG_879234
- Console.WriteLine("\n\tPassing structure that has no layout and CANNOT be marshaled");
- try
- {
- Marshal.SizeOf(typeof(StructWithFxdLPSTRSAFld));
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-#endif
-
- Console.WriteLine("\n\tPassing structure that has layout and can be marshaled");
- Marshal.SizeOf(someTs.GetType());
-
- Console.WriteLine("DONE testing SizeOf.");
-
-#if BUG_879276
- //////////////////////////////////////////////////////////////
- //UnsafeAddrOfPinnedArrayElement
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting UnsafeAddrOfPinnedArrayElement...");
- Console.WriteLine("\tPassing arr=null");
- try
- {
- Marshal.UnsafeAddrOfPinnedArrayElement<Object>(null, 123);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("DONE testing UnsafeAddrOfPinnedArrayElement.");
-#endif
-
-#if BUG_879276
- //////////////////////////////////////////////////////////////
- //OffsetOf
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting OffsetOf...");
-
- Console.WriteLine("\n\tMake sure that generic and non generic versions of the API returns the same offset.");
- IntPtr nonGenericOffsetCall = Marshal.OffsetOf(typeof(SomeTestStruct), "i");
- IntPtr genericOffsetCall = Marshal.OffsetOf<SomeTestStruct>("i");
- if (nonGenericOffsetCall != genericOffsetCall)
- {
- retVal = 0;
- Console.WriteLine("\t\tERROR: Generic and non generic versions of the API did not return the same offset!");
- }
-
- Console.WriteLine("\n\tPassing structure that has no layout and CANNOT be marshaled");
- try
- {
- Marshal.OffsetOf(typeof(StructWithFxdLPSTRSAFld), "Arr");
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("DONE testing OffsetOf.");
-#endif
-
- //////////////////////////////////////////////////////////////
- //PtrToStringAnsi
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting PtrToStringAnsi...");
- Console.WriteLine("\n\tPassing ptr = null");
- try
- {
- Marshal.PtrToStringAnsi(IntPtr.Zero, 123);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing len < 0 ");
- try
- {
- Marshal.PtrToStringAnsi(new IntPtr(123), -77);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("DONE testing PtrToStringAnsi.");
-
- //////////////////////////////////////////////////////////////
- //PtrToStringUni
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting PtrToStringUni...");
- Console.WriteLine("\n\tPassing len < 0 ");
- try
- {
- Marshal.PtrToStringUni(new IntPtr(123), -77);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("DONE testing PtrToStringUni.");
-
- //////////////////////////////////////////////////////////////
- //Copy
- /////////////////////////////////////////////////////////////
- Console.WriteLine("\nTesting Copy...");
- Console.WriteLine("\n\tPassing psrc = null ");
- try
- {
- byte[] barr = null;
- Marshal.Copy(barr, 0, new IntPtr(123), 10);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentNullException ane)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ane.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("\n\tPassing startindex > numelem ");
- try
- {
- byte[] barr = new byte[2];
- Marshal.Copy(barr, 100, new IntPtr(123), 2);
- retVal = 0;
- Console.WriteLine("\t\tNO EXCEPTION THROWN! FAILED!");
- }
- catch (ArgumentOutOfRangeException ae)
- {
- Console.WriteLine("\t\tCaught Expected Exception:\n\t\t\t" + ae.ToString());
- }
- catch (Exception e)
- {
- retVal = 0;
- Console.WriteLine("\t\tUNEXPECTED EXCEPTION:\n\t\t\t" + e.ToString());
- }
-
- Console.WriteLine("DONE testing Copy.");
-
- return retVal;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj b/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj
deleted file mode 100644
index e698c96c2b..0000000000
--- a/tests/src/Interop/MarshalAPI/Miscellaneous/MarshalClassTests.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>MarshalClassTests</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- <NoWarn>0618;0649</NoWarn>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="MarshalClassTests.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.cs b/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.cs
deleted file mode 100644
index b56155aea6..0000000000
--- a/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.cs
+++ /dev/null
@@ -1,374 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-
-public struct someStruct
-{
- public bool p;
- private int var;
-}
-
-[StructLayout(LayoutKind.Explicit)]
-public class MySystemTime
-{
- [FieldOffset(0)]
- public ushort wYear;
- [FieldOffset(2)]
- public ushort wMonth;
- [FieldOffset(4)]
- public ushort wDayOfWeek;
- [FieldOffset(6)]
- public ushort wDay;
- [FieldOffset(8)]
- public ushort wHour;
- [FieldOffset(10)]
- public ushort wMinute;
- [FieldOffset(12)]
- public ushort wSecond;
- [FieldOffset(14)]
- public ushort wMilliseconds;
-}
-
-[StructLayout(LayoutKind.Sequential)]
-public class MyPoint
-{
- public int x;
- public int y;
-}
-
-public class NoLayoutPoint
-{
- public int x;
- public int y;
-}
-
-[StructLayout(LayoutKind.Sequential)]
-public class NonExistField
-{
-
-}
-
-[StructLayout(LayoutKind.Explicit)]
-internal struct ExplicitLayoutTest
-{
- [FieldOffset(0)]
- public short m_short1; // 2 bytes
- [FieldOffset(2)]
- public short m_short2; // 2 bytes
-
- [FieldOffset(4)]
- public byte union1_byte1; // 1 byte
- [FieldOffset(5)]
- public byte union1_byte2; // 1 byte
- [FieldOffset(6)]
- public short union1_short1; // 2 bytes
- [FieldOffset(8)]
- public Int32 union1_int1; // 4 bytes
- [FieldOffset(12)]
- public Int32 union1_int2; // 4 bytes
- [FieldOffset(16)]
- public double union1_double1; // 8 bytes
-
- [FieldOffset(4)]
- public ushort union2_ushort1; // 2 bytes
- [FieldOffset(6)]
- public ushort union2_ushort2; // 2 bytes
- [FieldOffset(8)]
- public Int32 union3_int1; // 4 bytes
- [FieldOffset(8)]
- public decimal union3_decimal1; // 16 bytes
-
- [FieldOffset(24)]
- public ushort m_ushort1; // 2 bytes
- // 6 bytes of padding
-
- [FieldOffset(32)]
- public decimal m_decimal1; // 16 bytes
-
- [FieldOffset(48)]
- public char m_char1; // 1 byte
- // 7 bytes of padding
-}
-
-internal struct FieldAlignmentTest
-{
- public byte m_byte1; // 1 byte
- // 1 byte of padding
-
- public short m_short1; // 2 bytes
- public short m_short2; // 2 bytes
- // 2 bytes of padding
-
- public Int32 m_int1; // 4 bytes
- public byte m_byte2; // 1 byte
- // 3 bytes of padding
-
- public Int32 m_int2; // 4 bytes
- // 4 bytes of padding (0 bytes on x86/Unix according System V ABI as double 4-byte aligned)
-
- public double m_double1; // 8 bytes
- public char m_char1; // 1 byte
- public char m_char2; // 1 byte
- public char m_char3; // 1 byte
- // 5 bytes of padding (1 byte on x86/Unix according System V ABI as double 4-byte aligned)
-
- public double m_double2; // 8 bytes
- public byte m_byte3; // 1 byte
- public byte m_byte4; // 1 byte
- // 6 bytes of padding
-
- public decimal m_decimal1; // 16 bytes
- public char m_char4; // 1 byte
- // 7 bytes of padding
-}
-
-struct FieldAlignmentTest_Decimal
-{
- public byte b; // 1 byte
- // 7 bytes of padding
-
- // The largest field in below struct is decimal (16 bytes wide).
- // However, alignment requirement for the below struct should be only 8 bytes (not 16).
- // This is because unlike fields of other types well known to mcg (like long, char etc.)
- // which need to be aligned according to their byte size, decimal is really a struct
- // with 8 byte alignment requirement.
- public FieldAlignmentTest p; // 80 bytes (72 bytes on x86/Unix)
-
- public short s; // 2 bytes
- // 6 bytes of padding
-}
-
-struct FieldAlignmentTest_Guid
-{
- public byte b; // 1 byte
- // 3 bytes of padding
-
- // Guid is really a struct with 4 byte alignment requirement (which is less than its byte size of 16 bytes).
- public Guid g; // 16 bytes
-
- public short s; // 2 bytes
- // 2 bytes of padding
-}
-
-struct FieldAlignmentTest_Variant
-{
- public byte b; // 1 byte
- // 7 bytes of padding
-
- // Using [MarshalAs(UnmanagedType.Struct)] means that the Variant type will be used for field 'v' on native side.
- // Variant is really a struct with 8 byte alignment requirement (which is less than its byte size of 24 / 16 bytes).
- [MarshalAs(UnmanagedType.Struct)]
- public object v; // 16 bytes on 32-bit, 24 bytes on 64-bit
-
- public short s; // 2 bytes
- // 6 bytes of padding
-};
-
-public class OffsetTest
-{
-
- public static void NullParameter()
- {
- Assert.Throws<ArgumentNullException>(() => Marshal.OffsetOf(null, null));
- Assert.Throws<ArgumentNullException>(() => Marshal.OffsetOf(new object().GetType(), null));
- Assert.Throws<ArgumentNullException>(() => Marshal.OffsetOf(null, "abcd"));
- }
-
-
- public static void NonExistField()
- {
- Assert.Throws<ArgumentException>(() => Marshal.OffsetOf(typeof(NonExistField), "NonExistField"));
- }
-
-
- public static void NoLayoutClass()
- {
- Assert.Throws<ArgumentException>(() => Marshal.OffsetOf(typeof(NoLayoutPoint), "x"));
- }
-
-
- public static void StructField()
- {
- Assert.AreEqual(new IntPtr(4), Marshal.OffsetOf(typeof(someStruct), "var"));
- }
-
-
- public static void ClassExplicitField()
- {
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(typeof(MySystemTime), "wYear"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(typeof(MySystemTime), "wHour"));
- Assert.AreEqual(new IntPtr(14), Marshal.OffsetOf(typeof(MySystemTime), "wMilliseconds"));
- }
-
-
- public static void ClassSequentialField()
- {
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(typeof(MyPoint), "x"));
- Assert.AreEqual(new IntPtr(4), Marshal.OffsetOf(typeof(MyPoint), "y"));
- }
-
-
- public static void ProjectedType()
- {
-#if BUG_1212387
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(typeof(Windows.Foundation.Point), "_x"));
- Assert.AreEqual(new IntPtr(1), Marshal.OffsetOf(typeof(Windows.UI.Color), "_R"));
-#endif
- }
-
-
-
- public static void TestExplicitLayout()
- {
- var t = typeof(ExplicitLayoutTest);
- Assert.AreEqual(56, Marshal.SizeOf(t));
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(t, "m_short1"));
- Assert.AreEqual(new IntPtr(2), Marshal.OffsetOf(t, "m_short2"));
-
- Assert.AreEqual(new IntPtr(4), Marshal.OffsetOf(t, "union1_byte1"));
- Assert.AreEqual(new IntPtr(5), Marshal.OffsetOf(t, "union1_byte2"));
- Assert.AreEqual(new IntPtr(6), Marshal.OffsetOf(t, "union1_short1"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(t, "union1_int1"));
- Assert.AreEqual(new IntPtr(12), Marshal.OffsetOf(t, "union1_int2"));
- Assert.AreEqual(new IntPtr(16), Marshal.OffsetOf(t, "union1_double1"));
-
- Assert.AreEqual(new IntPtr(4), Marshal.OffsetOf(t, "union2_ushort1"));
- Assert.AreEqual(new IntPtr(6), Marshal.OffsetOf(t, "union2_ushort2"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(t, "union3_int1"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(t, "union3_decimal1"));
-
- Assert.AreEqual(new IntPtr(24), Marshal.OffsetOf(t, "m_ushort1"));
- Assert.AreEqual(new IntPtr(32), Marshal.OffsetOf(t, "m_decimal1"));
- Assert.AreEqual(new IntPtr(48), Marshal.OffsetOf(t, "m_char1"));
- }
-
-
- public static void TestFieldAlignment()
- {
- var t = typeof(FieldAlignmentTest);
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || (RuntimeInformation.ProcessArchitecture != Architecture.X86))
- {
- Assert.AreEqual(80, Marshal.SizeOf(t));
- }
- else
- {
- Assert.AreEqual(72, Marshal.SizeOf(t));
- }
-
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(t, "m_byte1"));
- Assert.AreEqual(new IntPtr(2), Marshal.OffsetOf(t, "m_short1"));
- Assert.AreEqual(new IntPtr(4), Marshal.OffsetOf(t, "m_short2"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(t, "m_int1"));
- Assert.AreEqual(new IntPtr(12), Marshal.OffsetOf(t, "m_byte2"));
- Assert.AreEqual(new IntPtr(16), Marshal.OffsetOf(t, "m_int2"));
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || (RuntimeInformation.ProcessArchitecture != Architecture.X86))
- {
- Assert.AreEqual(new IntPtr(24), Marshal.OffsetOf(t, "m_double1"));
- Assert.AreEqual(new IntPtr(32), Marshal.OffsetOf(t, "m_char1"));
- Assert.AreEqual(new IntPtr(33), Marshal.OffsetOf(t, "m_char2"));
- Assert.AreEqual(new IntPtr(34), Marshal.OffsetOf(t, "m_char3"));
- Assert.AreEqual(new IntPtr(40), Marshal.OffsetOf(t, "m_double2"));
- Assert.AreEqual(new IntPtr(48), Marshal.OffsetOf(t, "m_byte3"));
- Assert.AreEqual(new IntPtr(49), Marshal.OffsetOf(t, "m_byte4"));
- Assert.AreEqual(new IntPtr(56), Marshal.OffsetOf(t, "m_decimal1"));
- Assert.AreEqual(new IntPtr(72), Marshal.OffsetOf(t, "m_char4"));
- }
- else
- {
- Assert.AreEqual(new IntPtr(20), Marshal.OffsetOf(t, "m_double1"));
- Assert.AreEqual(new IntPtr(28), Marshal.OffsetOf(t, "m_char1"));
- Assert.AreEqual(new IntPtr(29), Marshal.OffsetOf(t, "m_char2"));
- Assert.AreEqual(new IntPtr(30), Marshal.OffsetOf(t, "m_char3"));
- Assert.AreEqual(new IntPtr(32), Marshal.OffsetOf(t, "m_double2"));
- Assert.AreEqual(new IntPtr(40), Marshal.OffsetOf(t, "m_byte3"));
- Assert.AreEqual(new IntPtr(41), Marshal.OffsetOf(t, "m_byte4"));
- Assert.AreEqual(new IntPtr(48), Marshal.OffsetOf(t, "m_decimal1"));
- Assert.AreEqual(new IntPtr(64), Marshal.OffsetOf(t, "m_char4"));
- }
- }
-
-
- public static void TestFieldAlignment_Decimal()
- {
- var t = typeof(FieldAlignmentTest_Decimal);
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || (RuntimeInformation.ProcessArchitecture != Architecture.X86))
- {
- Assert.AreEqual(96, Marshal.SizeOf(t));
- }
- else
- {
- Assert.AreEqual(88, Marshal.SizeOf(t));
- }
-
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(t, "b"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(t, "p"));
-
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || (RuntimeInformation.ProcessArchitecture != Architecture.X86))
- {
- Assert.AreEqual(new IntPtr(88), Marshal.OffsetOf(t, "s"));
- }
- else
- {
- Assert.AreEqual(new IntPtr(80), Marshal.OffsetOf(t, "s"));
- }
- }
-
-
- public static void TestFieldAlignment_Guid()
- {
- var t = typeof(FieldAlignmentTest_Guid);
- Assert.AreEqual(24, Marshal.SizeOf(t));
-
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(t, "b"));
- Assert.AreEqual(new IntPtr(4), Marshal.OffsetOf(t, "g"));
- Assert.AreEqual(new IntPtr(20), Marshal.OffsetOf(t, "s"));
- }
-
-
- public static void TestFieldAlignment_Variant()
- {
- var t = typeof(FieldAlignmentTest_Variant);
-
- Assert.AreEqual(new IntPtr(0), Marshal.OffsetOf(t, "b"));
- Assert.AreEqual(new IntPtr(8), Marshal.OffsetOf(t, "v"));
-
- if (IntPtr.Size == 4)
- {
- Assert.AreEqual(new IntPtr(24), Marshal.OffsetOf(t, "s"));
- Assert.AreEqual(32, Marshal.SizeOf(t));
- }
- else if (IntPtr.Size == 8)
- {
- Assert.AreEqual(new IntPtr(32), Marshal.OffsetOf(t, "s"));
- Assert.AreEqual(40, Marshal.SizeOf(t));
- }
- else
- {
- Assert.Fail(string.Format("Unexpected value '{0}' for IntPtr.Size", IntPtr.Size));
- }
- }
-
- public static int Main(String[] args)
- {
- //https://github.com/dotnet/coreclr/issues/2075
- //TestFieldAlignment_Variant();
- TestFieldAlignment_Guid();
- TestFieldAlignment_Decimal();
- TestFieldAlignment();
- TestExplicitLayout();
- ClassSequentialField();
- NullParameter();
- NonExistField();
- NoLayoutClass();
- StructField();
- ClassExplicitField();
- return 100;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj b/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj
deleted file mode 100644
index 4997b15849..0000000000
--- a/tests/src/Interop/MarshalAPI/OffsetOf/OffsetOf.csproj
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>OffsetOf</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- <NoWarn>0618;0649;0169</NoWarn>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.cs b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.cs
deleted file mode 100644
index eb36714802..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-
-
-public class ReadWriteByteTest
-{
- private byte[] TestValues = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, byte.MaxValue };
-
- private void NullValueTests()
- {
- byte value;
-
- try
- {
- value = Marshal.ReadByte(IntPtr.Zero);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- value = Marshal.ReadByte(IntPtr.Zero, 2);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteByte(IntPtr.Zero, TestValues[0]);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteByte(IntPtr.Zero, 2, TestValues[0]);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException") {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
- }
-
- private void ReadWriteRoundTripTests()
- {
- int sizeOfArray = Marshal.SizeOf(TestValues[0]) * TestValues.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
- Marshal.WriteByte(ptr, TestValues[0]);
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- Marshal.WriteByte(ptr, i * Marshal.SizeOf(TestValues[0]), TestValues[i]);
- }
-
- byte value = Marshal.ReadByte(ptr);
- if (!value.Equals(TestValues[0]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
- }
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- value = Marshal.ReadByte(ptr, i * Marshal.SizeOf(TestValues[0]));
- if (!value.Equals(TestValues[i]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
- }
- }
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- ReadWriteRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- new ReadWriteByteTest().RunTests();
- return 100;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.csproj b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.csproj
deleted file mode 100644
index c78ffefd05..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteByte.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>ReadWriteByte</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <!-- This test is disabled until #12224 is fixed -->
- <GCStressIncompatible>true</GCStressIncompatible>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ReadWriteByte.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.cs b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.cs
deleted file mode 100644
index 7ba83961b3..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-
-public class ReadWriteInt16Test
-{
- private short[] TestValues = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, short.MaxValue };
-
- private void NullValueTests()
- {
- short value;
-
- try
- {
- value = Marshal.ReadInt16(IntPtr.Zero);
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- value = Marshal.ReadInt16(IntPtr.Zero, 2);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteInt16(IntPtr.Zero, TestValues[0]);
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteInt16(IntPtr.Zero, 2, TestValues[0]);
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
- }
-
- private void ReadWriteRoundTripTests()
- {
- int sizeOfArray = Marshal.SizeOf(TestValues[0]) * TestValues.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
-
- Marshal.WriteInt16(ptr, TestValues[0]);
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- Marshal.WriteInt16(ptr, i * Marshal.SizeOf(TestValues[0]), TestValues[i]);
- }
-
-
- short value = Marshal.ReadInt16(ptr);
- if (!value.Equals(TestValues[0]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
-
- }
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- value = Marshal.ReadInt16(ptr, i * Marshal.SizeOf(TestValues[0]));
- if (!value.Equals(TestValues[i]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
-
- }
- }
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- ReadWriteRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- new ReadWriteInt16Test().RunTests();
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.csproj b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.csproj
deleted file mode 100644
index fc63d21d4e..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt16.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>ReadWriteInt16</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <!-- This test is disabled until #12224 is fixed -->
- <GCStressIncompatible>true</GCStressIncompatible>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ReadWriteInt16.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.cs b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.cs
deleted file mode 100644
index be9408a6c9..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.cs
+++ /dev/null
@@ -1,142 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-
-public class ReadWriteInt32Test
-{
- private int[] TestValues = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, int.MaxValue };
-
- private void NullValueTests()
- {
- int value;
-
- try
- {
- value = Marshal.ReadInt32(IntPtr.Zero);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- value = Marshal.ReadInt32(IntPtr.Zero, 2);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteInt32(IntPtr.Zero, TestValues[0]);
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteInt32(IntPtr.Zero, 2, TestValues[0]);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
- }
-
- private void ReadWriteRoundTripTests()
- {
- int sizeOfArray = Marshal.SizeOf(TestValues[0]) * TestValues.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
- Marshal.WriteInt32(ptr, TestValues[0]);
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- Marshal.WriteInt32(ptr, i * Marshal.SizeOf(TestValues[0]), TestValues[i]);
- }
-
- int value = Marshal.ReadInt32(ptr);
- if (!value.Equals(TestValues[0]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
- }
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- value = Marshal.ReadInt32(ptr, i * Marshal.SizeOf(TestValues[0]));
- if (!value.Equals(TestValues[i]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
- }
- }
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- ReadWriteRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- new ReadWriteInt32Test().RunTests();
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.csproj b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.csproj
deleted file mode 100644
index 0aea271102..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt32.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>ReadWriteInt32</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <!-- This test is disabled until #12224 is fixed -->
- <GCStressIncompatible>true</GCStressIncompatible>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ReadWriteInt32.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.cs b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.cs
deleted file mode 100644
index 029cdd534f..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-
-
-public class ReadWriteInt64Test
-{
- private long[] TestValues = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, long.MaxValue };
-
- private void NullValueTests()
- {
- long value;
-
- try
- {
- value = Marshal.ReadInt64(IntPtr.Zero);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- value = Marshal.ReadInt64(IntPtr.Zero, 2);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteInt64(IntPtr.Zero, TestValues[0]);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteInt64(IntPtr.Zero, 2, TestValues[0]);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
- }
-
- private void ReadWriteRoundTripTests()
- {
- int sizeOfArray = Marshal.SizeOf(TestValues[0]) * TestValues.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
-
- Marshal.WriteInt64(ptr, TestValues[0]);
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- Marshal.WriteInt64(ptr, i * Marshal.SizeOf(TestValues[0]), TestValues[i]);
- }
-
-
-
- long value = Marshal.ReadInt64(ptr);
- if (!value.Equals(TestValues[0]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
- }
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- value = Marshal.ReadInt64(ptr, i * Marshal.SizeOf(TestValues[0]));
- if (!value.Equals(TestValues[i]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
-
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- ReadWriteRoundTripTests();
- }
-
- public static int Main(String[] unusedArgs)
- {
- new ReadWriteInt64Test().RunTests();
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.csproj b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.csproj
deleted file mode 100644
index 685368be92..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteInt64.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>ReadWriteInt64</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <!-- This test is disabled until #12224 is fixed -->
- <GCStressIncompatible>true</GCStressIncompatible>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ReadWriteInt64.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.cs b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.cs
deleted file mode 100644
index abd0a69b19..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-using System.Runtime.InteropServices.ComTypes;
-
-public class ReadWriteIntPtrTest
-{
- private IntPtr[] TestValues;
-
- private void NullValueTests()
- {
- IntPtr value;
-
- try
- {
- value = Marshal.ReadIntPtr(IntPtr.Zero);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- value = Marshal.ReadIntPtr(IntPtr.Zero, 2);
-
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException") // ProjectN throws NullReferenceException
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteIntPtr(IntPtr.Zero, TestValues[0]);
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
-
- }
- else
- {
- throw e;
- }
- }
-
- try
- {
- Marshal.WriteIntPtr(IntPtr.Zero, 2, TestValues[0]);
- }
- catch (Exception e)
- {
- if (e.GetType().FullName == "System.AccessViolationException")
- {
-
- }
- else if (e.GetType().FullName == "System.NullReferenceException")
- {
-
- }
- else
- {
- throw e;
- }
- }
- }
-
- private void ReadWriteRoundTripTests()
- {
- int sizeOfArray = Marshal.SizeOf(TestValues[0]) * TestValues.Length;
-
- IntPtr ptr = Marshal.AllocCoTaskMem(sizeOfArray);
-
-
- Marshal.WriteIntPtr(ptr, TestValues[0]);
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- Marshal.WriteIntPtr(ptr, i * Marshal.SizeOf(TestValues[0]), TestValues[i]);
- }
-
-
- IntPtr value = Marshal.ReadIntPtr(ptr);
- if (!value.Equals(TestValues[0]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
- }
-
- for (int i = 1; i < TestValues.Length; i++)
- {
- value = Marshal.ReadIntPtr(ptr, i * Marshal.SizeOf(TestValues[0]));
- if (!value.Equals(TestValues[i]))
- {
- throw new Exception("Failed round trip ReadWrite test.");
-
- }
- }
-
- Marshal.FreeCoTaskMem(ptr);
- }
-
- public void RunTests()
- {
- NullValueTests();
- ReadWriteRoundTripTests();
- }
-
- public void Initialize()
- {
-
- TestValues = new IntPtr[10];
- for (int i = 0; i < TestValues.Length; i++)
- TestValues[i] = new IntPtr(i);
- }
-
- public static int Main(String[] unusedArgs)
- {
- ReadWriteIntPtrTest test = new ReadWriteIntPtrTest();
- test.Initialize();
- test.RunTests();
- return 100;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.csproj b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.csproj
deleted file mode 100644
index 5287d8853d..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteIntPtr.csproj
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>ReadWriteIntPtr</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <!-- This test is disabled until #12224 is fixed -->
- <GCStressIncompatible>true</GCStressIncompatible>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ReadWriteIntPtr.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.cs b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.cs
deleted file mode 100644
index 951954f2e2..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.cs
+++ /dev/null
@@ -1,116 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Threading.Tasks;
-
-using CoreFXTestLibrary;
-
-internal struct BlittableStruct
-{
- internal int a;
- internal int b;
- internal byte c;
- internal short d;
- internal IntPtr p;
-}
-
-internal struct StructWithReferenceTypes
-{
- internal IntPtr ptr;
- internal string str;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
- internal int[] byValArr;
-}
-
-class Test
-{
- static int Main(string[] args)
- {
- TestNegativeCases();
- TestBlittableStruct();
- TestStructWithReferenceType();
-
- return 100;
- }
-
- static void TestNegativeCases()
- {
- Assert.Throws<AccessViolationException>(() => { Marshal.WriteByte(null, 0, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.WriteInt16(null, 0, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.WriteInt32(null, 0, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.WriteInt64(null, 0, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.WriteIntPtr(null, 0, IntPtr.Zero); });
- Assert.Throws<AccessViolationException>(() => { Marshal.ReadByte(null, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.ReadInt16(null, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.ReadInt32(null, 0); });
- Assert.Throws<AccessViolationException>(() => { Marshal.ReadIntPtr(null, 0); });
- }
-
- static void TestBlittableStruct()
- {
- Console.WriteLine("TestBlittableStruct");
-
- BlittableStruct blittableStruct = new BlittableStruct();
- blittableStruct.a = 200;
- blittableStruct.b = 300;
- blittableStruct.c = 10;
- blittableStruct.d = 123;
- blittableStruct.p = new IntPtr(100);
-
- object boxedBlittableStruct = (object)blittableStruct;
-
- int offsetOfB = Marshal.OffsetOf<BlittableStruct>("b").ToInt32();
- int offsetOfC = Marshal.OffsetOf<BlittableStruct>("c").ToInt32();
- int offsetOfD = Marshal.OffsetOf<BlittableStruct>("d").ToInt32();
- int offsetOfP = Marshal.OffsetOf<BlittableStruct>("p").ToInt32();
-
- Assert.AreEqual(Marshal.ReadInt32(boxedBlittableStruct, 0), 200);
- Assert.AreEqual(Marshal.ReadInt32(boxedBlittableStruct, offsetOfB), 300);
- Assert.AreEqual(Marshal.ReadByte(boxedBlittableStruct, offsetOfC), 10);
- Assert.AreEqual(Marshal.ReadInt16(boxedBlittableStruct, offsetOfD), 123);
- Assert.AreEqual(Marshal.ReadIntPtr(boxedBlittableStruct, offsetOfP), new IntPtr(100));
-
- Marshal.WriteInt32(boxedBlittableStruct, 0, 300);
- Marshal.WriteInt32(boxedBlittableStruct, offsetOfB, 400);
- Marshal.WriteByte(boxedBlittableStruct, offsetOfC, 20);
- Marshal.WriteInt16(boxedBlittableStruct, offsetOfD, 144);
-
- Marshal.WriteIntPtr(boxedBlittableStruct, offsetOfP, new IntPtr(500));
-
- Assert.AreEqual(((BlittableStruct)boxedBlittableStruct).a, 300);
- Assert.AreEqual(((BlittableStruct)boxedBlittableStruct).b, 400);
- Assert.AreEqual(((BlittableStruct)boxedBlittableStruct).c, 20);
- Assert.AreEqual(((BlittableStruct)boxedBlittableStruct).d, 144);
- Assert.AreEqual(((BlittableStruct)boxedBlittableStruct).p, new IntPtr(500));
- }
-
- static void TestStructWithReferenceType()
- {
- Console.WriteLine("TestStructWithReferenceType");
-
- StructWithReferenceTypes structWithReferenceTypes = new StructWithReferenceTypes();
- structWithReferenceTypes.ptr = new IntPtr(100);
- structWithReferenceTypes.str = "ABC";
- structWithReferenceTypes.byValArr = new int[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
-
- object boxedStruct = (object)structWithReferenceTypes;
-
- int offsetOfStr = Marshal.OffsetOf<StructWithReferenceTypes>("str").ToInt32();
- int offsetOfByValArr = Marshal.OffsetOf<StructWithReferenceTypes>("byValArr").ToInt32();
-
- Assert.AreEqual(Marshal.ReadInt32(boxedStruct, 0), 100);
- Assert.AreNotEqual(Marshal.ReadIntPtr(boxedStruct, offsetOfStr), IntPtr.Zero);
- Assert.AreEqual(Marshal.ReadInt32(boxedStruct, offsetOfByValArr + sizeof(int) * 2), 3);
-
- Marshal.WriteInt32(boxedStruct, 0, 200);
- Marshal.WriteInt32(boxedStruct, offsetOfByValArr + sizeof(int) * 9, 100);
-
- Assert.AreEqual(((StructWithReferenceTypes)boxedStruct).ptr, new IntPtr(200));
- Assert.AreEqual(((StructWithReferenceTypes)boxedStruct).byValArr[9], 100);
- Assert.AreEqual(((StructWithReferenceTypes)boxedStruct).byValArr[8], 9);
- Assert.AreEqual(((StructWithReferenceTypes)boxedStruct).str, "ABC");
- }
-}
-
diff --git a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.csproj b/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.csproj
deleted file mode 100644
index 14fcd2c97d..0000000000
--- a/tests/src/Interop/MarshalAPI/ReadWrite/ReadWriteObject.csproj
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>ReadWriteObject</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
-
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- </PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="ReadWriteObject.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project>
diff --git a/tests/src/Interop/MarshalAPI/String/StringMarshalingTest.cs b/tests/src/Interop/MarshalAPI/String/StringMarshalingTest.cs
deleted file mode 100644
index 2ec0a9c69b..0000000000
--- a/tests/src/Interop/MarshalAPI/String/StringMarshalingTest.cs
+++ /dev/null
@@ -1,270 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-using System;
-using System.IO;
-using System.Reflection;
-using System.Security;
-using System.Runtime.InteropServices;
-
-public class StringMarshalingTest
-{
- private readonly String[] TestStrings = new String[] {
- "", //Empty String
- "Test String",
- "A", //Single character string
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself. " +
- "This is a very long string as it repeats itself.",
- "This \n is \n a \n multiline \n string",
- "This \0 is \0 a \0 string \0 with \0 nulls",
- "\0string",
- "string\0",
- "\0\0\0\0\0\0\0\0"
- };
-
-
- private void StringToBStrToString()
- {
- foreach (String ts in TestStrings)
- {
-
- IntPtr BStr = Marshal.StringToBSTR(ts);
- String str = Marshal.PtrToStringBSTR(BStr);
-
- if (!str.Equals(ts))
- {
- throw new Exception();
- }
- Marshal.FreeBSTR(BStr);
-
-
- }
- }
-
- private unsafe void SecureStringToBSTRToString()
- {
- foreach (String ts in TestStrings)
- {
- SecureString secureString = new SecureString();
- foreach (char character in ts)
- {
- secureString.AppendChar(character);
- }
-
- IntPtr BStr = IntPtr.Zero;
- String str;
-
- try
- {
- BStr = Marshal.SecureStringToBSTR(secureString);
- str = Marshal.PtrToStringBSTR(BStr);
- }
- finally
- {
- if (BStr != IntPtr.Zero)
- {
- Marshal.ZeroFreeBSTR(BStr);
- }
- }
-
- if (!str.Equals(ts))
- {
- throw new Exception();
- }
- }
- }
-
- private void StringToCoTaskMemAnsiToString()
- {
- foreach (String ts in TestStrings)
- {
- if (ts.Contains("\0"))
- continue; //Skip the string with nulls case
-
-
- IntPtr AnsiStr = Marshal.StringToCoTaskMemAnsi(ts);
- String str = Marshal.PtrToStringAnsi(AnsiStr);
-
- if (!str.Equals(ts))
- {
- throw new Exception();
- }
- if (ts.Length > 0)
- {
- String str2 = Marshal.PtrToStringAnsi(AnsiStr, ts.Length - 1);
-
- if (!str2.Equals(ts.Substring(0, ts.Length - 1)))
- {
- throw new Exception();
- }
- }
- Marshal.FreeCoTaskMem(AnsiStr);
-
-
- }
- }
-
- private void StringToCoTaskMemUniToString()
- {
- foreach (String ts in TestStrings)
- {
- if (ts.Contains("\0"))
- continue; //Skip the string with nulls case
-
-
- IntPtr UniStr = Marshal.StringToCoTaskMemUni(ts);
- String str = Marshal.PtrToStringUni(UniStr);
-
- if (!str.Equals(ts))
- {
- throw new Exception();
- }
- if (ts.Length > 0)
- {
- String str2 = Marshal.PtrToStringUni(UniStr, ts.Length - 1);
-
- if (!str2.Equals(ts.Substring(0, ts.Length - 1)))
- {
- throw new Exception();
- }
- }
- Marshal.FreeCoTaskMem(UniStr);
-
-
- }
- }
-
- private void StringToHGlobalAnsiToString()
- {
- foreach (String ts in TestStrings)
- {
- if (ts.Contains("\0"))
- continue; //Skip the string with nulls case
-
- IntPtr AnsiStr = Marshal.StringToHGlobalAnsi(ts);
- String str = Marshal.PtrToStringAnsi(AnsiStr);
-
- if (!str.Equals(ts))
- {
- throw new Exception();
- }
- if (ts.Length > 0)
- {
- String str2 = Marshal.PtrToStringAnsi(AnsiStr, ts.Length - 1);
-
- if (!str2.Equals(ts.Substring(0, ts.Length - 1)))
- {
- throw new Exception();
- }
- }
- Marshal.FreeHGlobal(AnsiStr);
-
-
-
- }
- }
-
- private void StringToHGlobalUniToString()
- {
- foreach (String ts in TestStrings)
- {
- if (ts.Contains("\0"))
- continue; //Skip the string with nulls case
-
-
- IntPtr UniStr = Marshal.StringToHGlobalUni(ts);
- String str = Marshal.PtrToStringUni(UniStr);
-
- if (!str.Equals(ts))
- {
- throw new Exception();
- }
- if (ts.Length > 0)
- {
- String str2 = Marshal.PtrToStringUni(UniStr, ts.Length - 1);
-
- if (!str2.Equals(ts.Substring(0, ts.Length - 1)))
- {
- throw new Exception();
- }
- }
- Marshal.FreeHGlobal(UniStr);
- }
-
- }
-
- public void TestUTF8String()
- {
- foreach (String srcString in TestStrings)
- {
- // we assume string null terminated
- if (srcString.Contains("\0"))
- continue;
-
- IntPtr ptrString = Marshal.StringToCoTaskMemUTF8(srcString);
- string retString = Marshal.PtrToStringUTF8(ptrString);
-
- if (!srcString.Equals(retString))
- {
- throw new Exception("Round triped strings do not match...");
- }
- if (srcString.Length > 0)
- {
- string retString2 = Marshal.PtrToStringUTF8(ptrString, srcString.Length - 1);
- if (!retString2.Equals(srcString.Substring(0, srcString.Length - 1)))
- {
- throw new Exception("Round triped strings do not match...");
- }
- }
- Marshal.FreeHGlobal(ptrString);
- }
- }
-
- private void TestNullString()
- {
- if (Marshal.PtrToStringUTF8(IntPtr.Zero) != null)
- {
- throw new Exception("IntPtr.Zero not marshaled to null for UTF8 strings");
- }
-
- if (Marshal.PtrToStringUni(IntPtr.Zero) != null)
- {
- throw new Exception("IntPtr.Zero not marshaled to null for Unicode strings");
- }
-
- if (Marshal.PtrToStringAnsi(IntPtr.Zero) != null)
- {
- throw new Exception("IntPtr.Zero not marshaled to null for ANSI strings");
- }
- }
-
- public bool RunTests()
- {
- StringToBStrToString();
- SecureStringToBSTRToString();
- StringToCoTaskMemAnsiToString();
- StringToCoTaskMemUniToString();
- StringToHGlobalAnsiToString();
- StringToHGlobalUniToString();
- TestUTF8String();
- TestNullString();
- return true;
- }
-
- public static int Main(String[] unusedArgs)
- {
- return new StringMarshalingTest().RunTests() ? 100 : 99;
- }
-
-}
diff --git a/tests/src/Interop/MarshalAPI/String/StringMarshalingTest.csproj b/tests/src/Interop/MarshalAPI/String/StringMarshalingTest.csproj
deleted file mode 100644
index 797e8ef3fa..0000000000
--- a/tests/src/Interop/MarshalAPI/String/StringMarshalingTest.csproj
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>StringMarshalingTest</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"></PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"></PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
diff --git a/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.cs b/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.cs
deleted file mode 100644
index 89cf6b962f..0000000000
--- a/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using System.IO;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using CoreFXTestLibrary;
-
-public class UnsafeAddrOfPinnedArrayElementTest
-{
-
- public static void NullParameter()
- {
- Assert.Throws<ArgumentNullException>(() => Marshal.UnsafeAddrOfPinnedArrayElement(null, 1));
- int [] array = new int[]{1,2,3};
- GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned);
- Assert.Throws<ArgumentOutOfRangeException>(() => Marshal.UnsafeAddrOfPinnedArrayElement<int>(array, -1));
- Assert.Throws<ArgumentOutOfRangeException>(() => Marshal.UnsafeAddrOfPinnedArrayElement<int>(array, 3));
-
- handle.Free();
- }
-
-
- public static void PrimitiveType()
- {
- int [] array = new int[]{1,2,3};
- GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned);
-
-
- IntPtr v0 = Marshal.UnsafeAddrOfPinnedArrayElement<int>(array, 0);
- Assert.AreEqual(1, Marshal.ReadInt32(v0));
-
- IntPtr v1 = Marshal.UnsafeAddrOfPinnedArrayElement<int>(array, 1);
- Assert.AreEqual(2, Marshal.ReadInt32(v1));
-
- IntPtr v2 = Marshal.UnsafeAddrOfPinnedArrayElement<int>(array, 2);
- Assert.AreEqual(3, Marshal.ReadInt32(v2));
-
- handle.Free();
- }
-
-
- struct Point
- {
- public int x;
- public int y;
- }
-
-
- public static void StructType()
- {
- Point [] array = new Point[]{
- new Point(){x = 100, y = 100},
- new Point(){x = -1, y = -1},
- new Point(){x = 0, y = 0},
- };
- GCHandle handle = GCHandle.Alloc(array, GCHandleType.Pinned);
-
-
- IntPtr v0 = Marshal.UnsafeAddrOfPinnedArrayElement<Point>(array, 0);
- Point p0 = Marshal.PtrToStructure<Point>(v0);
- Assert.AreEqual(100, p0.x);
- Assert.AreEqual(100, p0.y);
-
- IntPtr v1 = Marshal.UnsafeAddrOfPinnedArrayElement<Point>(array, 1);
- Point p1 = Marshal.PtrToStructure<Point>(v1);
- Assert.AreEqual(-1, p1.x);
- Assert.AreEqual(-1, p1.y);
-
-
- IntPtr v2 = Marshal.UnsafeAddrOfPinnedArrayElement<Point>(array, 2);
- Point p2 = Marshal.PtrToStructure<Point>(v2);
- Assert.AreEqual(0, p2.x);
- Assert.AreEqual(0, p2.y);
-
-
- handle.Free();
-
-
- }
-
- public static int Main(String[] args) {
-
- StructType();
- PrimitiveType();
- //NullParameter();
- return 100;
- }
-}
diff --git a/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj b/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj
deleted file mode 100644
index 5459790b76..0000000000
--- a/tests/src/Interop/MarshalAPI/UnsafeAddrOfPinnedArrayElement/UnsafeAddrOfPinnedArrayElement.csproj
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <AssemblyName>UnsafeAddrOfPinnedArrayElement</AssemblyName>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{F1E66554-8C8E-4141-85CF-D0CD6A0CD0B0}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <DefineConstants>$(DefineConstants);STATIC</DefineConstants>
- <NoWarn>0618</NoWarn>
- <CLRTestPriority>1</CLRTestPriority>
- </PropertyGroup>
- <!-- Default configurations to help VS understand the configurations -->
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"></PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"></PropertyGroup>
- <ItemGroup>
- <CodeAnalysisDependentAssemblyPaths Condition=" '$(VS100COMNTOOLS)' != '' " Include="$(VS100COMNTOOLS)..\IDE\PrivateAssemblies">
- <Visible>False</Visible>
- </CodeAnalysisDependentAssemblyPaths>
- </ItemGroup>
- <ItemGroup>
- <Compile Include="*.cs" />
- <Compile Include="..\..\common\Assertion.cs" />
- </ItemGroup>
- <ItemGroup>
- <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\Common\CoreCLRTestLibrary\CoreCLRTestLibrary.csproj">
- <Project>{c8c0dc74-fac4-45b1-81fe-70c4808366e0}</Project>
- <Name>CoreCLRTestLibrary</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
-</Project> \ No newline at end of file
diff --git a/tests/testsUnsupportedOutsideWindows.txt b/tests/testsUnsupportedOutsideWindows.txt
index d4928b20aa..aa56d76944 100644
--- a/tests/testsUnsupportedOutsideWindows.txt
+++ b/tests/testsUnsupportedOutsideWindows.txt
@@ -124,9 +124,6 @@ CoreMangLib/system/collections/generic/hashset/Regression_Dev10_609271/Regressio
CoreMangLib/system/collections/generic/hashset/Regression_Dev10_624201/Regression_Dev10_624201.sh
GC/Coverage/smalloom/smalloom.sh
Interop/COM/NETClients/Primitives/NETClientPrimitives/NETClientPrimitives.sh
-Interop/MarshalAPI/GetNativeVariantForObject/GetNativeVariantForObject/GetNativeVariantForObject.sh
-Interop/MarshalAPI/GetObjectForNativeVariant/GetObjectForNativeVariant/GetObjectForNativeVariant.sh
-Interop/MarshalAPI/GetObjectsForNativeVariants/GetObjectsForNativeVariants/GetObjectsForNativeVariants.sh
Interop/MarshalAPI/IUnknown/IUnknownTest/IUnknownTest.sh
Interop/SizeConst/SizeConstTest/SizeConstTest.sh
JIT/Directed/coverage/oldtests/callipinvoke/callipinvoke.sh